Esempio n. 1
0
 public HeroCelebrateState(HeroStateMachine HSM) : base(HSM)
 {
     hero.sprite.LoadAnimation(hero.CelebrateAnimation);
     hero.InvincibilityFrames = 0;
     hero.Movement            = 0;
     hero.Velocity            = new Vector2(0, hero.Velocity.Y);
 }
Esempio n. 2
0
        public HeroRunningState(HeroStateMachine HSM) : base(HSM)
        {
            hero.sprite.LoadAnimation(hero.RunAnimation);

            //only do the run animation if velocity is above a threshold
            //to eliminate errors from sensitive keyboards or something
            //if (Math.Abs(hero.Velocity.X) - 0.02f > 0)
            //{
            //    hero.Sprite.LoadAnimation(hero.RunAnimation);
            //}
            //else
            //    hero.Sprite.LoadAnimation(hero.IdleAnimation);
        }
Esempio n. 3
0
 public void Swap(HeroStateMachine otherHSM)
 {
     if (otherHSM.Character.IsAlive)
     {
         MainState    = (State)Activator.CreateInstance(otherHSM.MainState.GetType(), this);
         ShooterState = (State)Activator.CreateInstance(otherHSM.ShooterState.GetType(), this);
         ShieldState  = (State)Activator.CreateInstance(otherHSM.ShieldState.GetType(), this);
     }
     else
     {
         Reset();
     }
 }
Esempio n. 4
0
 public NotBlockingState(HeroStateMachine HSM) : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("NotBlockingState");
 }
Esempio n. 5
0
 public ShieldState(HeroStateMachine HSM) : base(HSM)
 {
     hsm  = HSM;
     hero = (Hero)HSM.Character;
 }
Esempio n. 6
0
 public ShieldHitState(HeroStateMachine HSM)
     : base(HSM)
 {
     hero.ShieldHitTime = hero.MaxShieldHitTime;
     System.Diagnostics.Debug.WriteLine("ShieldHitState");
 }
Esempio n. 7
0
 public HeroShooterState(HeroStateMachine HSM)
     : base(HSM)
 {
     this.hsm = (HeroStateMachine)sm;
     hero     = (Hero)character;
 }
Esempio n. 8
0
 public HeroJumpingState(HeroStateMachine HSM) : base(HSM)
 {
     hero.sprite.LoadAnimation(hero.JumpAnimation);
     character.JumpSound.Play();
 }
Esempio n. 9
0
 protected virtual void LoadContent()
 {
     stateMachine = new HeroStateMachine(this);
 }
Esempio n. 10
0
 public HeroReloadingState(HeroStateMachine HSM)
     : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("ReloadingState");
 }
Esempio n. 11
0
 public HeroIdleState(HeroStateMachine HSM) : base(HSM)
 {
     hero.sprite.LoadAnimation(hero.IdleAnimation);
 }
Esempio n. 12
0
 public HeroMainState(HeroStateMachine hsm) : base(hsm)
 {
     this.hsm = (HeroStateMachine)sm;
     hero     = (Hero)character;
 }
Esempio n. 13
0
 public HeroSwitchWeaponState(HeroStateMachine HSM)
     : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("SwitchWeaponState");
 }
Esempio n. 14
0
 public DepletedState(HeroStateMachine HSM)
     : base(HSM)
 {
     hero.DepletedShieldTime = hero.MaxDepletedShieldTime;
     System.Diagnostics.Debug.WriteLine("DepletedState");
 }