I am a Unity refugee, trying to rework my game into Godot. TL;DR, what is the best method in Godot to approach custom objects in Godot?
One of the features I spent months working on for my game was a special system for Stats. I created a Stat interface that contained some events and other variables for me to monitor.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IStat
{
//-----------------------------------------
//Variables
//-----------------------------------------
int baseValue {get; set;}
int bonusValue {get; set;}
int currentValue {get; set;}
List<IStat> statList {get; set;}
//-----------------------------------------
//Events
//event EventHandler OnStatDamage;
//event EventHandler OnStatHeal;
//event EventHandler OnStatBuff;
//event EventHandler OnStatNerf;
//------------------------------------
//Functions
//------------------------------------
string GetStatType();
//------------------------------------
}
I used this interface to create different Stat objects, and store them in a dictionary in the player script. They could be added and removed as needed.
I am sure I could brute force something like this in C#, but I am really trying to embrace Godot 4 and it's different design philosophies when it comes to game development. And that includes using GDScript instead of C#!
So I wanted to know what would be the proper way to approach this concept from a Godot developer perspective, instead of a Unity developer?