void SwitchAnimation(CurrentAnimationState newState) { if (animState != newState) { switch (newState) { case CurrentAnimationState.idle: if (Type == UnitType.Soldier) { animState = newState; anim.SetTrigger("Idle"); } break; case CurrentAnimationState.move: animState = newState; anim.SetTrigger("Move"); break; case CurrentAnimationState.attack: animState = newState; anim.SetTrigger("Attack"); break; case CurrentAnimationState.die: if (Type != UnitType.Base) { animState = newState; anim.SetTrigger("Die"); } break; } } }
void Start() { CharacterSelect(); anim = character.GetComponent <Animation>(); controller = GameObject.Find("Main Camera").GetComponent <CameraController>(); state = CurrentAnimationState.IDLE; }
public void Down() { IsIdle = false; if (CurrentPowerState is MarioBigState || CurrentPowerState is MarioStarBigState || CurrentPowerState is MarioFireState) { Location += new Vector2(Util.Instance.Vector_initial_i, Util.Instance.Go_down_vec2_y); } CurrentAnimationState.Down(); }
public void Up() { if (CurrentAnimationState is MarioDeadState) { return; } IsIdle = false; CurrentAnimationState.Up(); }
public static Composite CreateWaitWhileRunningAttackingChannelingOrCasting() { return (new Decorator( ret => CurrentAnimationState.HasFlag((AnimationState)15), new Action(ret => RunStatus.Success) )); }
public void EndForward() { if (!Statics.ComputerMode) { forwardPressed = false; anim.Stop(); state = CurrentAnimationState.IDLE; } }
public void BeginForward() { if (!Statics.ComputerMode) { forwardPressed = true; anim.Stop(); state = CurrentAnimationState.RUN; } }
void EndForwardArrow() { if (forwardPressed) { forwardButton.interactable = true; anim.Stop(); state = CurrentAnimationState.IDLE; forwardPressed = false; } Statics.ComputerMode = false; }
void BeginForwardArrow() { Statics.ComputerMode = true; if (!forwardPressed) { forwardButton.interactable = false; anim.Stop(); state = CurrentAnimationState.RUN; forwardPressed = true; } }
public void Draw(SpriteBatch spriteBatch) { if (!isFlash) { CurrentAnimationState.Draw(spriteBatch, Location); } else if (damageTimer % 2 == Util.Instance.Zero) { CurrentAnimationState.Draw(spriteBatch, Location); } foreach (Fireball fireball in fireballs) { fireball.Draw(spriteBatch); } foreach (ScoreObject score in ScoreObjects) { score.Draw(spriteBatch); } }
public void Update(GameTime gametime) { if (damageTimer == Util.Instance.DamageTimer) { canTakeDamage = true; isFlash = false; damageTimer = Util.Instance.Zero; } if (!canTakeDamage) { damageTimer++; } if (CurrentPowerState is MarioStarBigState || CurrentPowerState is MarioStarSmallState) { if (starTimer == Util.Instance.FiveHundreds) { if (CurrentPowerState is MarioStarBigState) { CurrentPowerState = new MarioBigState(this); } else { CurrentPowerState = new MarioSmallState(this); } starTimer = Util.Instance.Zero; } starTimer++; } foreach (Fireball fireball in fireballs) { fireball.Update(gametime); } foreach (ScoreObject score in ScoreObjects) { score.Update(gametime); } Rectangle = new Rectangle((int)Location.X, (int)Location.Y, CurrentAnimationState.Width, CurrentAnimationState.Height); if (IsIdle) { PreviousAnimationState = CurrentAnimationState; CurrentAnimationState.Idle(); MarioPhysics.Idle(); } IsIdle = true; if (!isAlive) { CurrentAnimationState = new MarioDeadState(); } CurrentAnimationState.Update(gametime); MarioPhysics.Update(gametime); CheckDeath(); if (CurrentAnimationState is MarioDeadState) { deathTimer++; } if (deathTimer == Util.Instance.TwoHundreds) { deathTimer = Util.Instance.Zero; resetWorld = true; } }