コード例 #1
0
 /// <summary>
 /// Collide actions if bullet zombies die and boss loses health. If bullet it gets removed and if player it gets damage.
 /// </summary>
 /// <param name="otherObject">The object it collided with</param>
 public override void DoCollision(GameObject otherObject)
 {
     // cheker om enemyen går in i et solid obejt
     if (otherObject is SolidObejts || otherObject is NoTwalkerbelObejt && lastmovemet < 2)
     {
         SetRandomDirection();
         lastmovemet = 0;
     }
     /// checker om Enemyen bliver ramt
     if (otherObject is Bullet)
     {
         Blood       blood       = new Blood(Position, content);
         BloodEffect bloodEffect = new BloodEffect(1, position, content);
         GameWorld.AddEFfect(blood);
         GameWorld.AddGameObject(bloodEffect);
         GameWorld.RemoveGameObject(this);
         GameWorld.addKill();
     }
     // Attacks og checker for sistet attack så der ikke bliver angrabet hvert fram
     if (otherObject is Player && LastAttck > 0.5f)
     {
         PlayerBlood playerBlood = new PlayerBlood(realTimeplayerPosition, content);
         GameWorld.DealDamngeToPlayer(damage);
         GameWorld.AddGameObject(playerBlood);
         LastAttck = 0;
     }
     if (otherObject is Bullet)
     {
         GameWorld.RemoveGameObject(otherObject);
     }
 }
コード例 #2
0
        /// <summary>
        /// Sets the direction of the boss in direction of the player
        /// </summary>
        ///


        /// <summary>
        /// Collide actions if bullet zombies die and boss loses health. If bullet it gets removed and if player it gets damage.
        /// </summary>
        /// <param name="otherObject">The object it collided with</param>
        public override void DoCollision(GameObject otherObject)
        {
            if (otherObject is Bullet)
            {
                Blood       blood       = new Blood(Position, content);
                BloodEffect bloodEffect = new BloodEffect(1, position, content);
                GameWorld.AddEFfect(blood);
                GameWorld.AddGameObject(bloodEffect);
                bosshealth--;
                if (bosshealth == 0)
                {
                    Player.KilledBoss = true;
                    GameWorld.RemoveGameObject(this);
                    GameWorld.addKill();
                }
            }

            if (otherObject is SolidObejts || otherObject is NoTwalkerbelObejt && lastmovemet < 2)
            {
                SetRandomDirection();
                lastmovemet = 0;
            }
            if (otherObject is Player && LastAttck > 0.5f)
            {
                PlayerBlood playerBlood = new PlayerBlood(realTimeplayerPosition, content);
                GameWorld.DealDamngeToPlayer(damnge);
                GameWorld.AddGameObject(playerBlood);
                LastAttck = 0;
            }

            if (otherObject is Bullet)
            {
                GameWorld.RemoveGameObject(otherObject);
            }
        }
コード例 #3
0
        public override void DoCollision(GameObject otherObject)
        {
            MouseState mouse = Mouse.GetState();

            if (otherObject is sighte && Tag == "TeakstBox" && mouse.LeftButton == ButtonState.Pressed)
            {
                GameWorld.GameEnding1 = true;
                Blood       blood       = new Blood(Position, Content);
                BloodEffect bloodEffect = new BloodEffect(1, position, Content);
                GameWorld.AddEFfect(blood);
                GameWorld.AddGameObject(bloodEffect);
                GameWorld.cutScenemanager = 1;
            }
            if (otherObject is sighte && Tag == "TeakstBox2" && mouse.LeftButton == ButtonState.Pressed)
            {
                GameWorld.GameEnding2 = true;

                GameWorld.cutScenemanager = 1;

                Blood       blood       = new Blood(Position, Content);
                BloodEffect bloodEffect = new BloodEffect(1, position, Content);
                GameWorld.AddEFfect(blood);
                GameWorld.AddGameObject(bloodEffect);
            }
        }