Simple Question: Animations and Base Class

Hello. Just a simple question:
Is it possible to work with animations inside of abstract class?

Lets say I have:

public abstract class Enemy {

    private AnimationClip _attackAnimation;

    public virtual void Attack() {

        // and now I want do do something like this:
        GetComponent<Animation>().CrossFade(_attackAnimation.name);
    }
}

Thanks for any help.

Yes

You need to subclass your Enemy class to actually do anything with it, but this is exactly how you implement abstract classes.

Though, for that to work, your Enemy class has to inherit from MonoBehaviour, otherwise GetComponent doesn’t exist.