Exemplo n.º 1
0
            PartOfWorldView CreatePooledObject(Controllers.PlayerLeavePartOfWorldSignal playerLeavePartOfWorldSignal)
            {
                PartOfWorldView newPart = Instantiate(GameWorldModel.Instance.PartOfWorldPrefab);

                pooledObjects.Add(newPart);
                newPart.gameObject.SetActive(false);
                newPart.InitSignal(playerLeavePartOfWorldSignal);
                return(newPart);
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public void RemovePart(PartOfWorldView part)
 {
     part.gameObject.SetActive(false);
 }