예제 #1
0
        public static void UnregisterBomb(GenericDeviceGameObject bombObject)
        {
            bombsList.Remove(bombObject);

            MeshCollider collider = bombObject.transform.Find("Model").GetComponent <MeshCollider>();

            if (collider != null)
            {
                Board.Objects.Remove(collider);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public static GenericBomb GetBombByObject(GenericDeviceGameObject bombObject)
 {
     return(bombsList[bombObject]);
 }