public BunnyAnimationStateMachine(object _thisObject)
        {
            thisObject = _thisObject;
            AnimationState skatingRight = new FlipDirectionAnimationState(_thisObject, "Walk", ModelDirection.Right);

            skatingRight.Repeat = true;
            right = new AnimationCommandTest(AnimationCommandDictionary.register("MovingRightBunny"));

            AnimationState skatingLeft = new FlipDirectionAnimationState(_thisObject, "Walk", ModelDirection.Left);

            skatingLeft.Repeat = true;
            left = new AnimationCommandTest(AnimationCommandDictionary.register("MovingLeftBunny"));

            AnimationState dieing = new AnimationState(_thisObject, "Death");

            dieing.Repeat = false;
            die           = new AnimationCommandTest(AnimationCommandDictionary.register("DyingBunny"));

            Transition toDeath = new Transition();

            toDeath.nextState      = dieing;
            toDeath.transitionTest = die.thisCommand;

            Transition toRight = new Transition();

            toRight.nextState      = skatingRight;
            toRight.transitionTest = right.thisCommand;

            Transition toLeft = new Transition();

            toLeft.nextState      = skatingLeft;
            toLeft.transitionTest = left.thisCommand;

            dieing.addTransition(MessageTypes.animationCommand, toLeft);
            dieing.addTransition(MessageTypes.animationCommand, toRight);

            skatingRight.addTransition(MessageTypes.animationCommand, toLeft);
            skatingRight.addTransition(MessageTypes.animationCommand, toDeath);

            skatingLeft.addTransition(MessageTypes.animationCommand, toRight);
            skatingLeft.addTransition(MessageTypes.animationCommand, toDeath);

            InitialState = skatingLeft;
        }
Beispiel #2
0
        float speed = 5.0f; // default speed for patrol

        public MoveToSetpointBunnyState(Vector2 _setPoint) : base("MoveToSetpointBunnyState")
        {
            moveRightAnimationCommand = AnimationCommandDictionary.lookUp("MovingRightBunny");
            moveLeftAnimationCommand  = AnimationCommandDictionary.lookUp("MovingLeftBunny");
            setPoint = _setPoint;
        }
Beispiel #3
0
 public DeadBunnyState()
     : base("DeadBunnyState")
 {
     animationCommand = AnimationCommandDictionary.lookUp("DyingBunny");
 }
Beispiel #4
0
        float speed = 10.0f; // default speed for charging

        public ChargingBunnyState() : base("ChargingBunnyState")
        {
            moveRightAnimationCommand = AnimationCommandDictionary.lookUp("MovingRightBunny");
            moveLeftAnimationCommand  = AnimationCommandDictionary.lookUp("MovingLeftBunny");
        }
Beispiel #5
0
 public AttackingFlowerState()
     : base("AttackingFlowerState")
 {
     animationCommand = AnimationCommandDictionary.lookUp("AttackingFlower");
 }
Beispiel #6
0
 public EvilFlowerState()
     : base("EvilFlowerState")
 {
     animationCommand = AnimationCommandDictionary.lookUp("EvilFlower");
 }
Beispiel #7
0
 public DeadFlowerState()
     : base("DeadFlowerState")
 {
     animationCommand = AnimationCommandDictionary.lookUp("DyingFlower");
 }
        public FlowerAnimationStateMachine(object _thisObject)
        {
            thisObject = _thisObject;
            AnimationState idleAnim = new AnimationState(_thisObject, "Idle");

            idleAnim.Repeat = true;
            idle            = new AnimationCommandTest(AnimationCommandDictionary.register("IdleFlower"));

            AnimationState attackAnim = new AnimationState(_thisObject, "Attack");

            attackAnim.Repeat = true;
            attack            = new AnimationCommandTest(AnimationCommandDictionary.register("AttackingFlower"));

            AnimationState evilAnim = new AnimationState(_thisObject, "Evil");

            evilAnim.Repeat = true;
            evil            = new AnimationCommandTest(AnimationCommandDictionary.register("EvilFlower"));

            AnimationState dieAnim = new AnimationState(_thisObject, "Die");

            dieAnim.Repeat = false;
            die            = new AnimationCommandTest(AnimationCommandDictionary.register("DyingFlower"));

            Transition toDeath = new Transition();

            toDeath.nextState      = dieAnim;
            toDeath.transitionTest = die.thisCommand;

            Transition toIdle = new Transition();

            toIdle.nextState      = idleAnim;
            toIdle.transitionTest = idle.thisCommand;

            Transition toAttack = new Transition();

            toAttack.nextState      = attackAnim;
            toAttack.transitionTest = attack.thisCommand;

            Transition toEvil = new Transition();

            toEvil.nextState      = evilAnim;
            toEvil.transitionTest = evil.thisCommand;

            idleAnim.addTransition(MessageTypes.animationCommand, toEvil);
            idleAnim.addTransition(MessageTypes.animationCommand, toAttack);
            idleAnim.addTransition(MessageTypes.animationCommand, toDeath);

            evilAnim.addTransition(MessageTypes.animationCommand, toIdle);
            evilAnim.addTransition(MessageTypes.animationCommand, toAttack);
            evilAnim.addTransition(MessageTypes.animationCommand, toDeath);

            attackAnim.addTransition(MessageTypes.animationCommand, toIdle);
            attackAnim.addTransition(MessageTypes.animationCommand, toEvil);
            attackAnim.addTransition(MessageTypes.animationCommand, toDeath);

            dieAnim.addTransition(MessageTypes.animationCommand, toIdle);
            dieAnim.addTransition(MessageTypes.animationCommand, toEvil);
            dieAnim.addTransition(MessageTypes.animationCommand, toAttack);

            InitialState = idleAnim;
        }