private bool MissileToDestroyable(IMissile missile, DestroyableObj obj, CollisionParameters parameters) { if (obj is Character && missile.Owner == obj) return false; if (missile is Grenade) { if(missile.Owner!=obj) GrenadeExplosion(missile as Grenade, parameters); } else { int damage = missile.ImpactDamage; if (obj is Character) { (obj as Character).Player.OnMissileHit(missile, parameters); } if (remote) damage = 0; if (obj.TakeDamage(damage)) { if (obj is Character) { ((Character)missile.Owner).Player.OnEnemyDestroyed((obj as Character).Player); RemoveObject((IGameObject)missile); World.Instance.PlayerKilled((obj as Character).Player); } else { RemoveObject((IGameObject)missile); } } } return false; }
private bool DestroyableToStatic(DestroyableObj obj1, IGameObject obj2, CollisionParameters parameters) { if (obj1 is Character && obj2 is WeaponPickup) { if ((obj2 as WeaponPickup).Ready && ((obj1 as Character).CharacterClass.GameTeam == (obj2 as WeaponPickup).WeaponClass.GameTeam || (obj2 as WeaponPickup).WeaponClass.GameTeam == GameTeam.Both)) { //zbieranie broni (obj1 as Character).Weapons.AddWeapon((obj2 as WeaponPickup).WeaponClass); (obj1 as Character).Player.OnWeaponPickup((obj2 as WeaponPickup)); (obj2 as WeaponPickup).Use(); } return false; } else { if (obj1 is Character) { (obj1 as Character).Player.OnStaticCollision(obj2, parameters); if (parameters.RelativeVelocity.Length > 100) { int damage = (int)parameters.RelativeVelocity.Length - 100; if (obj1.TakeDamage(damage)) { PlayerKilled((obj1 as Character).Player); } } } return true; } return false; }