Exemple #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);
 }
Exemple #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);
        }
Exemple #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();
     }
 }
Exemple #4
0
 public NotBlockingState(HeroStateMachine HSM) : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("NotBlockingState");
 }
Exemple #5
0
 public ShieldState(HeroStateMachine HSM) : base(HSM)
 {
     hsm  = HSM;
     hero = (Hero)HSM.Character;
 }
Exemple #6
0
 public ShieldHitState(HeroStateMachine HSM)
     : base(HSM)
 {
     hero.ShieldHitTime = hero.MaxShieldHitTime;
     System.Diagnostics.Debug.WriteLine("ShieldHitState");
 }
Exemple #7
0
 public HeroShooterState(HeroStateMachine HSM)
     : base(HSM)
 {
     this.hsm = (HeroStateMachine)sm;
     hero     = (Hero)character;
 }
Exemple #8
0
 public HeroJumpingState(HeroStateMachine HSM) : base(HSM)
 {
     hero.sprite.LoadAnimation(hero.JumpAnimation);
     character.JumpSound.Play();
 }
Exemple #9
0
 protected virtual void LoadContent()
 {
     stateMachine = new HeroStateMachine(this);
 }
Exemple #10
0
 public HeroReloadingState(HeroStateMachine HSM)
     : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("ReloadingState");
 }
Exemple #11
0
 public HeroIdleState(HeroStateMachine HSM) : base(HSM)
 {
     hero.sprite.LoadAnimation(hero.IdleAnimation);
 }
Exemple #12
0
 public HeroMainState(HeroStateMachine hsm) : base(hsm)
 {
     this.hsm = (HeroStateMachine)sm;
     hero     = (Hero)character;
 }
Exemple #13
0
 public HeroSwitchWeaponState(HeroStateMachine HSM)
     : base(HSM)
 {
     System.Diagnostics.Debug.WriteLine("SwitchWeaponState");
 }
Exemple #14
0
 public DepletedState(HeroStateMachine HSM)
     : base(HSM)
 {
     hero.DepletedShieldTime = hero.MaxDepletedShieldTime;
     System.Diagnostics.Debug.WriteLine("DepletedState");
 }