コード例 #1
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Koopa2 koopa1 = (Koopa2)gameObject1;

            if (koopa1.State.GetType() == typeof(KoopaSideDeathState))
            {
                return;
            }
            Koopa2 koopa2 = (Koopa2)gameObject2;

            if (koopa2.State.GetType() == typeof(KoopaSideDeathState))
            {
                return;
            }

            if (koopa1.State.GetType() == typeof(KoopaDeadState) &&
                koopa1.Velocity.X != GameUtilities.StationaryVelocity)
            {
                ScoringSystem.Player1Score.AddPointsForEnemyHitByShell(gameObject1);
                koopa2.Terminate("DOWN");
                return;
            }
            if (koopa2.State.GetType() == typeof(KoopaDeadState) &&
                koopa2.Velocity.X != GameUtilities.StationaryVelocity)
            {
                ScoringSystem.Player1Score.AddPointsForEnemyHitByShell(gameObject2);
                koopa1.Terminate("DOWN");
                return;
            }

            koopa1.Location = new Vector2(koopa1.Location.X + GameUtilities.SinglePixel, koopa1.Location.Y);
            koopa1.ChangeDirection();
            koopa2.ChangeDirection();
        }
コード例 #2
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Koopa2 koopa = (Koopa2)gameObject1;

            if (koopa.State.GetType() == typeof(KoopaSideDeathState))
            {
                return;
            }
            Goomba2 goomba = (Goomba2)gameObject2;

            if (!goomba.Alive)
            {
                return;
            }

            if (koopa.State.GetType() == typeof(KoopaDeadState) &&
                koopa.Velocity.X != GameUtilities.StationaryVelocity)
            {
                ScoringSystem.Player1Score.AddPointsForEnemyHitByShell(gameObject1);
                goomba.Terminate("LEFT");
                return;
            }

            koopa.Location = new Vector2(koopa.Location.X - GameUtilities.SinglePixel, koopa.Location.Y);
            koopa.ChangeDirection();
            goomba.ChangeDirection();
        }
コード例 #3
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Koopa2 koopa = (Koopa2)gameObject1;

            if (koopa.State.GetType() == typeof(KoopaSideDeathState))
            {
                return;
            }

            if (gameObject2.GetType() == typeof(LPipeBottom) ||
                gameObject2.GetType() == typeof(LPipeBottomLeft))
            {
                return;
            }

            int koopaPreY = (int)(koopa.Location.Y - (koopa.Velocity.Y - GameUtilities.SinglePixel));

            if (koopaPreY + koopa.Destination.Height <= gameObject2.Location.Y)
            {
                return;
            }

            else if (koopaPreY > gameObject2.Location.Y + gameObject2.Destination.Height)
            {
                return;
            }
            if (koopa.Velocity.X < GameUtilities.StationaryVelocity)
            {
                koopa.ChangeDirection();
            }
        }
コード例 #4
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Horse  horse = (Horse)gameObject1;
            Koopa2 koopa = (Koopa2)gameObject2;

            horse.Location = new Vector2(horse.Location.X - GameUtilities.SinglePixel, horse.Location.Y);
            if (!horse.Alive)
            {
                return;
            }
            if (koopa.State.GetType() == typeof(KoopaDeadState) &&
                koopa.Velocity.X != GameUtilities.StationaryVelocity)
            {
                ScoringSystem.Player1Score.AddPointsForEnemyHitByShell(gameObject2);
                horse.Terminate("LEFT");
                return;
            }
            horse.ChangeDirection();
            koopa.ChangeDirection();
        }