public static void UnregisterBomb(GenericDeviceGameObject bombObject) { bombsList.Remove(bombObject); MeshCollider collider = bombObject.transform.Find("Model").GetComponent <MeshCollider>(); if (collider != null) { Board.Objects.Remove(collider); } }
public static List <GenericShip> GetShipsInRange(GenericDeviceGameObject bombObject) { List <GenericShip> result = new List <GenericShip>(); foreach (var ship in Roster.AllShips.Select(n => n.Value)) { if (!ship.IsDestroyed) { if (IsShipInRange(ship, bombObject, bombObject.ParentUpgrade.detonationRange)) { result.Add(ship); } } } return(result); }
public static bool IsShipInRange(GenericShip ship, GenericDeviceGameObject bombObject, int range = 1) { List <Vector3> bombPoints = GetBombPointsRelative(); foreach (var localBombPoint in bombPoints) { Vector3 globalBombPoint = bombObject.transform.TransformPoint(localBombPoint); foreach (var globalShipBasePoint in ship.ShipBase.GetStandPoints().Select(n => n.Value)) { if (Board.GetRangeBetweenPoints(globalBombPoint, globalShipBasePoint) <= range) { return(true); } } } return(false); }
public static GenericBomb GetBombByObject(GenericDeviceGameObject bombObject) { return(bombsList[bombObject]); }