Hello i got a problem with the update function. I got a class called HydraBehaviour
for my Hydra Enemy in my game. And the HydraBehaviour
inherites from the EnemyBehaviourClass
which is a class with a update method to ChasePlay();
and StopChasingPlayer();
.
And in my Hydra class I want to create the attack System, because not all Enemys will have the same time attacking style. And so my problem is i cant use the update method in Hydra Class, because its already used in the EnemyBehaviourClass
. So im forced to use Fixed Update but thats not the way to go. Im very sorry for my bad english, it would be nice if you can help me.
CodePudding user response:
You can have an update function in your HydraBehaviour and call the update function in EnemyBehaviourClass.
public class HydraBehaviour : EnemyBehaviourClass
{
void Update()
{
base.Update();
// Your Hydra specific code goes here
}
}
Just make sure your Update function in EnemyBehaviourClass is either public or protected. This will not work if the function is private.