public override void Collide(Sprite s) { //base.Collide(s); if (s.GetType() != typeof(Asteroid) && s.GetType() != typeof(Mine) && s.GetType() != typeof(EnemyBullet)) { CollisionHandler.Instance.unregister(this); Asteroid_Explosion _asteroid = (Asteroid_Explosion)Spawner.Instance.Spawn(Spawner.TypeOfGameObject.AsteroidBig_Explosion_64, new Vector2(PositionX - 32f, PositionY - 32f)); _asteroid.Scale = Scale; explosionSoundEffectInstance.Play(); GameObjectHandler.Instance.RemoveGameObject(this); int experience = GameObjectHandler.Instance.FindGameObjectProperty("DownGrade.Rocket"); if (s.GetType() == typeof(Bullet)) { GameObjectHandler.Instance.SetGameObjectProperty("DownGrade.Rocket", experience - 10); } } }
public override void Collide(Sprite s) { //base.Collide(s); if (s.GetType() != typeof(Asteroid)) { CollisionHandler.Instance.unregister(this); Asteroid_Explosion _asteroid = (Asteroid_Explosion)Spawner.Instance.Spawn(Spawner.TypeOfGameObject.AsteroidBig_Explosion_64, Position); _asteroid.Scale = Scale; explosionSoundEffectInstance.Play(); GameObjectHandler.Instance.RemoveGameObject(this); if (s.GetType() != typeof(Mine) || s.GetType() != typeof(Asteroid)) { int experience = GameObjectHandler.Instance.FindGameObjectProperty("DownGrade.Rocket"); if (s.GetType() == typeof(Bullet) || s.GetType() == typeof(Missile)) { GameObjectHandler.Instance.SetGameObjectProperty("DownGrade.Rocket", experience - 2); } } if (brokenState > 1 && s.GetType() != typeof(Rocket)) { for (int i = 0; i < brokenState; i++) { Asteroid a = (Asteroid)Spawner.Instance.Spawn(Spawner.TypeOfGameObject.AsteroidBig_64, Position); a.Scale = 0.5f; a.brokenState -= 1; a.Direction(); } } } }
public override void Collide(Sprite s) { if (s.GetType() != typeof(Mine)) { CollisionHandler.Instance.unregister(this); Asteroid_Explosion _asteroid = (Asteroid_Explosion)Spawner.Instance.Spawn(Spawner.TypeOfGameObject.AsteroidBig_Explosion_64, new Vector2(PositionX - 40f, PositionY - 40f)); explosionSoundEffectInstance.Play(); GameObjectHandler.Instance.RemoveGameObject(this); if (s.GetType() != typeof(Mine) || s.GetType() != typeof(Asteroid)) { int experience = GameObjectHandler.Instance.FindGameObjectProperty("DownGrade.Rocket"); Debug.Print("Hit! Experience = " + experience); if (s.GetType() == typeof(Bullet)) { GameObjectHandler.Instance.SetGameObjectProperty("DownGrade.Rocket", experience - 5); } } } }