Пример #1
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Koopa2 koopa = (Koopa2)gameObject1;

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

            if (!horse.Alive)
            {
                return;
            }

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

            koopa.Location = new Vector2(koopa.Location.X - GameUtilities.SinglePixel, koopa.Location.Y);
            koopa.ChangeDirection();
            horse.ChangeDirection();
        }
Пример #2
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Horse horse = (Horse)gameObject1;

            if (!horse.Alive)
            {
                return;
            }
            if (gameObject2.GetType() == typeof(LPipeBottom) ||
                gameObject2.GetType() == typeof(LPipeBottomLeft))
            {
                return;
            }
            int horsePreY = (int)(horse.Location.Y - (horse.Velocity.Y - GameUtilities.SinglePixel));

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

            else if (horsePreY > gameObject2.Location.Y + gameObject2.Destination.Height)
            {
                return;
            }
            if (horse.Velocity.X > GameUtilities.StationaryVelocity)
            {
                horse.ChangeDirection();
            }
        }
Пример #3
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            IMario mario  = (IMario)gameObject1;
            Horse  goomba = (Horse)gameObject2;

            if (mario.State.MarioShape == MarioState.MarioShapeEnums.Dead ||
                mario.IsProtected || !goomba.Alive)
            {
                return;
            }

            int marioPreY = (int)(mario.Destination.Y - (mario.Velocity.Y - GameUtilities.SinglePixel));

            if (marioPreY + mario.Destination.Height < gameObject2.Destination.Y)
            {
                ICollisionCommand TopCommand = new MarioGoombaCollisionTop();

                TopCommand.Execute(gameObject1, gameObject2);
                return;
            }

            else if (marioPreY > gameObject2.Destination.Y + gameObject2.Destination.Height)
            {
                ICollisionCommand BottomCommand = new MarioGoombaCollisionBottom();
                BottomCommand.Execute(gameObject1, gameObject2);
                return;
            }

            if (goomba.Alive)
            {
                if (mario.State.IsStar == true)
                {
                    ScoringSystem.Player1Score.AddPointsForSpecialGoombaHit(gameObject2);
                    goomba.Terminate("RIGHT");
                }
                else
                {
                    goomba.ChangeDirection();
                    switch (mario.State.MarioShape)
                    {
                    case MarioState.MarioShapeEnums.Small:
                        mario.State.Terminated();
                        break;

                    case MarioState.MarioShapeEnums.Big:
                        mario.IsProtected = true;
                        GameUtilities.GameObjectManager.MarioTransition(mario.State.MarioShape, MarioState.MarioShapeEnums.Small, mario);
                        SoundManager.Instance.PlayPipeSound();
                        break;

                    case MarioState.MarioShapeEnums.Fire:
                        mario.IsProtected = true;
                        GameUtilities.GameObjectManager.MarioTransition(mario.State.MarioShape, MarioState.MarioShapeEnums.Small, mario);
                        SoundManager.Instance.PlayPipeSound();
                        break;
                    }
                }
            }
        }
Пример #4
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Goomba2 goomba1 = (Goomba2)gameObject1;
            Horse   horse   = (Horse)gameObject2;

            goomba1.Location = new Vector2(goomba1.Location.X + GameUtilities.SinglePixel, goomba1.Location.Y);
            goomba1.ChangeDirection();
            horse.ChangeDirection();
        }
Пример #5
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Horse horse1 = (Horse)gameObject1;
            Horse horse2 = (Horse)gameObject2;

            horse1.Location = new Vector2(horse1.Location.X - GameUtilities.SinglePixel, horse1.Location.Y);
            horse1.ChangeDirection();
            horse2.ChangeDirection();
        }
Пример #6
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Horse horse1 = (Horse)gameObject1;

            if (horse1.Alive == false)
            {
                return;
            }
            Goomba2 goomba2 = (Goomba2)gameObject2;

            horse1.Location = new Vector2(horse1.Location.X - GameUtilities.SinglePixel, horse1.Location.Y);
            horse1.ChangeDirection();
            goomba2.ChangeDirection();
        }
Пример #7
0
        public void Execute(IGameObject gameObject1, IGameObject gameObject2)
        {
            Horse h         = (Horse)gameObject1;
            int   horsePreY = (int)(h.Location.Y - (h.Velocity.Y - GameUtilities.SinglePixel));

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

            else if (horsePreY > gameObject2.Location.Y + gameObject2.Destination.Height)
            {
                return;
            }
            if (h.Velocity.X < GameUtilities.StationaryVelocity)
            {
                h.ChangeDirection();
            }
        }