예제 #1
0
        public override void Update(GameTime i_GameTime)
        {
            bool  isSpeedUp = false, isJumpingBackwards = false;
            float originalDistanceToJump;
            int   timeToJump;

            originalDistanceToJump = GetEnemysAsList()[0].Width / 2;
            randomEnemyShooting();
            m_TimeCount += i_GameTime.ElapsedGameTime.Milliseconds;
            timeToJump   = m_JumpTwiceMilliSec / 2;
            if (m_TimeCount >= timeToJump)
            {
                jumpAllAliveEnemies(m_JumpDirection, originalDistanceToJump, isJumpingBackwards);
                if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndLeft))
                {
                    m_JumpDirection = SpriteJump.eJumpDirection.Left;
                }
                else if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndRight))
                {
                    m_JumpDirection = SpriteJump.eJumpDirection.Right;
                }

                SpriteJump.SpriteOverJumped enemyOverJumpedData = getEnemyOverJumpedData();
                if (enemyOverJumpedData.IsTouchedScreenHorizontalBoundary)
                {
                    switch (m_JumpDirection)
                    {
                    case SpriteJump.eJumpDirection.Right:
                        isJumpingBackwards = true;
                        jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards);
                        isSpeedUp       = true;
                        m_JumpDirection = SpriteJump.eJumpDirection.DownAndLeft;
                        break;

                    case SpriteJump.eJumpDirection.Left:
                        isJumpingBackwards = true;
                        jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards);
                        isSpeedUp       = true;
                        m_JumpDirection = SpriteJump.eJumpDirection.DownAndRight;
                        break;
                    }
                }

                m_TimeCount -= timeToJump;
                if (isSpeedUp)
                {
                    SpeedUp(0.95);
                }
            }
        }
예제 #2
0
        private SpriteJump.SpriteOverJumped getEnemyOverJumpedData()
        {
            SpriteJump.SpriteOverJumped enemyOverJumpedData = new SpriteJump.SpriteOverJumped()
            {
                IsTouchedScreenHorizontalBoundary = false
            };
            foreach (List <Enemy> enemyRow in r_EnemiesMatrix)
            {
                foreach (Enemy enemy in enemyRow)
                {
                    if (enemy.SpriteJump.OverJumpedData.IsTouchedScreenHorizontalBoundary)
                    {
                        enemyOverJumpedData             = enemy.SpriteJump.OverJumpedData;
                        enemy.SpriteJump.OverJumpedData = new SpriteJump.SpriteOverJumped()
                        {
                            IsTouchedScreenHorizontalBoundary = false
                        };
                    }
                }
            }

            return(enemyOverJumpedData);
        }
예제 #3
0
        private SpriteJump.SpriteOverJumped getEnemyOverJumpedData()
        {
            SpriteJump.SpriteOverJumped enemyOverJumpedData = new SpriteJump.SpriteOverJumped() { IsTouchedScreenHorizontalBoundary = false };
            foreach (List<Enemy> enemyRow in r_EnemiesMatrix)
            {
                foreach (Enemy enemy in enemyRow)
                {
                    if (enemy.SpriteJump.OverJumpedData.IsTouchedScreenHorizontalBoundary)
                    {
                        enemyOverJumpedData = enemy.SpriteJump.OverJumpedData;
                        enemy.SpriteJump.OverJumpedData = new SpriteJump.SpriteOverJumped() { IsTouchedScreenHorizontalBoundary = false };
                    }
                }
            }

            return enemyOverJumpedData;
        }