I’m returning a property in a function and using it again in another function. I get this error:
“An Object reference is required to access non-static member”
The line that has the problem is:
void Counter(Damage damage)
{
damage.Target.takeDamage(damage);
if(damage.Target.HP > 0) //SCALE WITH ATTACK (PLACEHOLDER 15)
DamageManager.DealDamage(damage.Target, damage.Attacker, Damage.E_Context.Counter, Damage.E_DamageType.Physical, 15); //ERROR
}
The DealDamage method requires a Character (another class I made) as a attacker, another one as a target, a enum which specifies the context of the damage (In this case it is a counter, that’s why target and attacker are switched), a enum to specify the type of damage and a value (15 is a placeholder),
This function recieves a Damage instance, which has all the elements formely mentioned.
damage.Target and damage.Attacker are properties so i only have a get inside it.