public System.Collections.IEnumerator PlaceShip(Ship ship) { bool placed = false; bool valid = false; if (ship != null) { ship.LoadModel(); ship.HideModel(); while (!placed) { yield return null; if (Input.GetKeyDown("r")) { if(placeOrientation == ShipOrientation.Horizontal) placeOrientation = ShipOrientation.Vertical; else placeOrientation = ShipOrientation.Horizontal; } if (Input.GetMouseButtonDown(0) && valid) { placed = true; break; } Point cast = getBoardRayCast(false, Color.white); if (ship.Place(cast, placeOrientation, gameSize)) { bool collides = false; foreach (Ship s in mShips) { if (s != ship) collides |= ship.ConflictsWith(s); } if (!collides) { ship.ShowModel(); valid = true; } else { ship.HideModel(); valid = false; } } else { ship.HideModel(); valid = false; } } } waitingForRoutine = false; curship++; }