Ejemplo n.º 1
0
    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;
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        CharacterSelect();

        anim       = character.GetComponent <Animation>();
        controller = GameObject.Find("Main Camera").GetComponent <CameraController>();
        state      = CurrentAnimationState.IDLE;
    }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 public void Up()
 {
     if (CurrentAnimationState is MarioDeadState)
     {
         return;
     }
     IsIdle = false;
     CurrentAnimationState.Up();
 }
Ejemplo n.º 5
0
 public static Composite CreateWaitWhileRunningAttackingChannelingOrCasting()
 {
     return
         (new Decorator(
              ret =>
              CurrentAnimationState.HasFlag((AnimationState)15),
              new Action(ret => RunStatus.Success)
              ));
 }
Ejemplo n.º 6
0
 public void EndForward()
 {
     if (!Statics.ComputerMode)
     {
         forwardPressed = false;
         anim.Stop();
         state = CurrentAnimationState.IDLE;
     }
 }
Ejemplo n.º 7
0
 public void BeginForward()
 {
     if (!Statics.ComputerMode)
     {
         forwardPressed = true;
         anim.Stop();
         state = CurrentAnimationState.RUN;
     }
 }
Ejemplo n.º 8
0
 void EndForwardArrow()
 {
     if (forwardPressed)
     {
         forwardButton.interactable = true;
         anim.Stop();
         state          = CurrentAnimationState.IDLE;
         forwardPressed = false;
     }
     Statics.ComputerMode = false;
 }
Ejemplo n.º 9
0
 void BeginForwardArrow()
 {
     Statics.ComputerMode = true;
     if (!forwardPressed)
     {
         forwardButton.interactable = false;
         anim.Stop();
         state          = CurrentAnimationState.RUN;
         forwardPressed = true;
     }
 }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        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;
            }
        }