So I have a Class called Character which represents all the player, his companions, and all enemies. This class does a lot of things including performing actions upon other characters, and upon the environment, and so on.
I'm about to start work on a battle system for this RPG, and there will be the player controlled (and enemy controlled) units which will have a location on the screen, and a delay since their last action, and a ton of other properties and methods that apply entirely to the battle. But, this thing will also be associated in a one-to-one relationship with a Character which exists separate from a battle. It will need to access that characters stats for it's battle actions as well as some of it's methods.
So the root of my question is, is it better to create a new "Unit" class, which references the character it's associated with, or should I just expand upon the existing Character class with functions and properties that relate only to a battle? If it matters I'm writing this in C#.
BattleCharacterreally is completely a sub-type ofCharacter, then subclass. Can you imagine a situation where a battlingUnitmight represent something other than aCharacter? (Maybe you might later want aCatapultUnitin the future which isn't aCharacter.) \$\endgroup\$Unit mainUnit = (Unit)existingCharacter?If Unit inherits from Character? That really would be ideal I think. \$\endgroup\$Unitinherits fromCharacterandexistingCharacteris aCharacter, thenUnit mainUnit = (Unit)existingCharacterwould fail, becauseUnitis a subclass ofCharacterand someCharacters might not beUnits. Did you mean the other way around (CharactersubclassesUnit)? \$\endgroup\$Unitobject. But if all I had was aCharacterobject, andUnitinherited fromCharacterwhat would be the best way of setting up aUnitobject which will have access to the data in an existingCharacterobject? \$\endgroup\$Characters (and anything else even totally unrelated that can participate in a battle) implementIBattler; then they'll all be fine to store in anIBattler-type variable. \$\endgroup\$