private void InstantiateNewObject(Waypoint waypoint) { if (!waypoint.isPlaceable) { Debug.Log("Waypoint: " + waypoint + " is not placeable"); return; } PlaceableObject newPlaceableObject = Instantiate(placeableObject, waypoint.transform.position, Quaternion.identity); newPlaceableObject.transform.parent = transform; newPlaceableObject.SetWaypoint(waypoint); factoryQueue.Enqueue(newPlaceableObject); waypoint.isPlaceable = false; newPlaceableObject.GetComponent <Collider>().enabled = true; //waypoint.isRoad = true; objectManager.placeableObjects.Add(newPlaceableObject.transform); if (newPlaceableObject.GetComponent <Factory>()) { objectManager.factories.Add(newPlaceableObject); } if (newPlaceableObject.GetComponent <HomeBase>()) { objectManager.factories.Add(newPlaceableObject); newPlaceableObject.GetComponent <HomeBase>().isHomebase = true; LevelManager.Instance.SetState(State.Game); FindObjectOfType <GameUIHandler>().SetButtonsDefaultColor(); SetActivePlaceableObject(null); } if (newPlaceableObject.GetComponent <Blocker>()) { objectManager.blockers.Add(newPlaceableObject.transform); } }