// ----- Engine funktioner ----- \\ private void OnCollisionEnter(Collision collision) { if (networkMaster == true) { IShip ship = collision.gameObject.GetComponent <IShip>(); if (ship != null) { if (ship != firedFromShip) { ship.ApplyDamage(firedFromShip.GetCannonDamage()); firedFromShip.GetGameManager().OnCannonBallDestroyed(this); } } else { Mine mine = collision.gameObject.GetComponent <Mine>(); if (mine != null) { mine.MineDestroyed(); } firedFromShip.GetGameManager().OnCannonBallDestroyed(this); } } }
///<summary>Bliver kaldt når vi rammer sammen med et andet objekt</summary> private void ShipCollisionHandler(Collision collision) { OnShipCollision(); IShip ship = collision.gameObject.GetComponent <IShip>(); if (ship != null) { ship.ApplyDamage(10 * (int)rigid.velocity.magnitude); } }
///<summary>Bliver kaldt når vi rammer sammen med et andet objekt</summary> private void MineCollisionHandler(Collision collision) { IShip ship = collision.gameObject.GetComponent <IShip>(); if (ship != null) { ship.ApplyDamage(mineDamage); MineDestroyed(); } }