PartOfWorldView CreatePooledObject(Controllers.PlayerLeavePartOfWorldSignal playerLeavePartOfWorldSignal) { PartOfWorldView newPart = Instantiate(GameWorldModel.Instance.PartOfWorldPrefab); pooledObjects.Add(newPart); newPart.gameObject.SetActive(false); newPart.InitSignal(playerLeavePartOfWorldSignal); return(newPart); }
public PartOfWorldView CreateNewPart(Controllers.PlayerLeavePartOfWorldSignal playerLeavePartOfWorldSignal) { InitializePool(playerLeavePartOfWorldSignal); PartOfWorldView newPart = pooledObjects.Find(nowPart => !nowPart.gameObject.activeInHierarchy); if (newPart == null) { newPart = CreatePooledObject(playerLeavePartOfWorldSignal); } newPart.gameObject.SetActive(true); return(newPart); }
public bool CreateNextPartOfWorld() { if (GameWorldModel.Instance.PartsOfWorld.Count >= GameWorldModel.MaxPartOfWorldCount) { return(false); } Vector3 position = GameWorldModel.Instance.PartsOfWorld.Count > 0 ? GameWorldModel.Instance.PartsOfWorld.ToArray()[GameWorldModel.Instance.PartsOfWorld.Count - 1].EndPointPosition : Vector3.zero; PartOfWorldView newPart = partsOfWorldManagerWorker.CreateNewPart(PlayerLeavePartOfWorldSignal); newPart.transform.position = position; newPart.transform.rotation = Quaternion.identity; GameWorldModel.Instance.PartsOfWorld.Enqueue(newPart as IPartOfWorldView); RelinkAllWaypoints(); return(true); }
public void RemovePart(PartOfWorldView part) { part.gameObject.SetActive(false); }