Beispiel #1
0
        public EnemyMind(IEntity Ent)
        {
            body = Ent;

            //Initialise the spriteSheet animation
            SpriteSheet = new SpriteSheetAnimation(body.Texture);

            //Create a new instance of State Machine
            StateMachine     = new StateMachine <IEntity>(body);
            AnimationMachine = new AnimationMachine <IEntity>(body);


            //Add Animation States
            AnimationMachine.AddState(new AnimationState(body, SpriteSheet, 12, 1), "left");
            AnimationMachine.AddState(new AnimationState(body, SpriteSheet, 12, 0), "right");

            //Add the states to the State Machine
            StateMachine.AddState(new Patrol <IEntity>(100, body.Position, AnimationMachine), "Patrol");
        }
Beispiel #2
0
        public PlayerMind(IEntity ent)
        {
            IdleState = "Idle_Right";
            body      = ent;
            input.AddKeyListener(OnNewKeyInput);
            //Add states to player for things liek climbing in order to counter the limitations of gravity
            StateMachine = new StateMachine <IEntity>(body);

            SpriteSheet = new SpriteSheetAnimation(body.Texture);
            Animations  = new AnimationMachine <IEntity>(body);

            StateMachine.AddState(new EmptyState <IEntity>(), "BaseState");
            StateMachine.AddState(new DamagedPlayerState <IEntity>(((Player)body), StateMachine, Animations), "Damaged");

            Animations.AddState(new AnimationState(body, SpriteSheet, 0, 0, 0, 1), "Idle_Left");
            Animations.AddState(new AnimationState(body, SpriteSheet, 0, 1, 0, 1), "Idle_Right");
            Animations.AddState(new AnimationState(body, SpriteSheet, 12, 0), "Walking_Left");
            Animations.AddState(new AnimationState(body, SpriteSheet, 12, 1), "Walking_Right");
            Animations.AddState(new AnimationState(body, SpriteSheet, 12, 2), "Climbing");
        }
Beispiel #3
0
 public DamagedPlayerState(Player player, IStateMachine <T> states, IAnimationMachine <T> animations)
 {
     Player     = player;
     States     = states;
     Animations = animations;
 }
Beispiel #4
0
 public Patrol(float range, Vector2 startingpoint, IAnimationMachine <T> animator)
 {
     moveRange   = range;
     PatrolPoint = startingpoint;
     Animator    = animator;
 }