Unity BaseStatsManager (C#)
Most games have characters with stats. The goal of the BaseStatsManager is to provide a template for setting up relevant stats and being able to easily apply them to any new character inserted into a scene. This class is easily modifiable for any type of game and is basically a set of variable declarations.
BaseStatsManager.cs
using UnityEngine; using System.Collections; // Used to manipulate the stats of an object. For interpreting these stats, // communicate with the BaseObjManager. public class BaseStatsManager : MonoBehaviour { // this is the display name of the character. public string characterName =""; public int score; public int level; public int health; public int maxHealth; }
The BaseStatsManager, or some variation of it, should be attached to each object in a scene that has stats. Note that the BaseStatsManager is purely for the manipulation of stats – interpreting the stats (which includes destroying the object or pooling it) is intended to be handled in BaseObjManager.