示例#1
0
        public void variateSprite(GameTime gameTime)
        {
            float duration = 0.1f;

            if (auxAtitude != atitude)
            {
                auxAtitude = atitude;
                variation  = 0;
            }

            if (auxState != enemy.actorState)
            {
                variation = 0;
                auxState  = enemy.actorState;
            }

            variateWalking();

            currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (currentTime >= duration)
            {
                variation++;
                currentTime -= duration;
            }

            if (variation >= 4)
            {
                variation = 0;
            }
        }
示例#2
0
        private void variateSprite(GameTime gameTime)
        {
            float duration = 0.1f;

            if (auxState != max.actorState)
            {
                variation = 0;
                auxState  = max.actorState;
            }

            int auxVar = 63 * (variation % 6);

            switch (auxState)
            {
            case Actor.Actor.ActorState.moveUp: max.source = new Rectangle(63 + (auxVar), 170, 63, 85); break;

            case Actor.Actor.ActorState.moveDown: max.source = new Rectangle(63 + (auxVar), 0, 63, 85); break;

            case Actor.Actor.ActorState.moveRight: max.source = new Rectangle(63 + (auxVar), 85, 63, 85); break;

            case Actor.Actor.ActorState.moveLeft: max.source = new Rectangle(63 + (auxVar), 255, 63, 85); break;
            }

            currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (currentTime >= duration)
            {
                variation++;
                currentTime -= duration;
            }

            if (variation >= 6)
            {
                variation = 0;
            }
        }
示例#3
0
        public void variateSprite(GameTime gameTime)
        {
            float duration = 0.1f;

            if (auxState != max.actorState)
            {
                variation = 0;
                auxState  = max.actorState;
            }

            currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (currentTime >= duration)
            {
                variation++;
                currentTime -= duration;
            }

            variateWalking();

            if (variation >= 5)
            {
                variation = 0;
            }
        }
示例#4
0
 public void Enter()
 {
     auxState = Actor.Actor.ActorState.idle;
 }
示例#5
0
 public void Enter()
 {
     auxState = enemy.actorState;
 }