public static void DestroyObstacle(GenericObstacle obstacle) { foreach (GenericShip ship in Roster.AllShips.Values) { ship.LandedOnObstacles.RemoveAll(n => n == obstacle); } Instance.Obstacles.Remove(obstacle); Board.Objects.Remove(obstacle.ObstacleGO.GetComponentInChildren <MeshCollider>()); GameObject.Destroy(obstacle.ObstacleGO); }
public static GenericObstacle GenerateObstacle(string shortName, PlayerNo playerNo) { GenericObstacle prefab = Instance.AllPossibleObstacles.First(n => n.ShortName == shortName); GenericObstacle newObstacle = (GenericObstacle)Activator.CreateInstance( prefab.GetType(), new object[] { prefab.Name, prefab.ShortName } ); Instance.ChosenObstacles.Add(newObstacle); return(newObstacle); }
public void DestroyObstacle(GenericObstacle obstacle) { Obstacles.Remove(obstacle); Board.Objects.Remove(obstacle.ObstacleGO.GetComponentInChildren <MeshCollider>()); GameObject.Destroy(obstacle.ObstacleGO); }