コード例 #1
0
ファイル: Avatar.cs プロジェクト: raysjoshua/DarwinsFinches
        public override void CollisionResolution(GameObject Item)
        {
            if (Item.GetType().Equals(typeof(DamageBox)))
            {
                DamageBox temp = Item as DamageBox;
                if (!temp.Friendly())
                {
                    SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
                    kinetics.ApplyForce(temp.kinetics.orientations.GetVecOrientation() * 30);
                }
            }

            if (Item.GetType().Equals(typeof(FireBall)))
            {
                FireBall temp = Item as FireBall;
                if (!temp.Friendly())
                {
                    SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
                }
            }
        }
コード例 #2
0
 public override void CollisionResolution(GameObject Item)
 {
     if (Item.GetType() == typeof(FireBall))
     {
         DamageBox temp = Item as DamageBox;
         if (!temp.Friendly())
         {
             if (hurtTimer.CurrentTime() == 0)
             {
                 color = Color.Red;
                 hurtTimer.Reset();
                 hurtTimer.Start();
             }
             health.decrease(1);
             if (health.Health() <= 0)
             {
                 Game1.exit = true;
             }
             SoundManager.Instance().AddSound(new SFX("SFX\\arrowhit"));
         }
     }
 }