I have a Player class, NPC class, BattleManager class, and Game class.
Player class stores/gets/sets player stats such as health, stamina, level, experience. NPC is similar, but is for NPCs. Game class instantiates Player class and NPC class. Game glass has two GameStates, battle and non-battle.
When the player is in battle, GameState goes to battle, when the battle finishes, it switches to non-battle.
What I'm trying to do is have the BattleManager class manage battles between the NPC and player, however, since the player and NPC object's are instantiated in Game class, I need to know how to pass that object or access it from BattleManager without instantiating a new one.
Can anyone suggest a general flow of how that might work? I know this is wrong, but is there a way to do something like Game.Player.Health -= damage;? For example, within the player class is public int Health get/set, how can I edit health from other classes when the Player class is instantiated in the Game class? Is there a way to pass the Player object around or just access the instantiated object created in the Game class from other classes?
TakeDamage. The responsability chain is also covered in some design patterns as well.public event BattleStarted ITSONandpublic delegate void BattleStarted(object sended, BattleStartedEventArgs e)andclass BattleStartedEventArgs : EventArgs { public Player One {get;set;} public NPC Two [get;set;} }