Esempio n. 1
0
        protected override void Awake()
        {
            base.Awake();

            SetGameVersion();

            if (canvasPrefab)
            {
                GameObjectExtend.CreateGameObject(canvasPrefab, out _, true);
            }

            if (eventSystemPrefab && !GameObject.FindObjectOfType <EventSystemManager>())
            {
                GameObjectExtend.CreateGameObject(eventSystemPrefab, out _, true);
            }

            if (blackPagePrefab)
            {
                GameObjectExtend.CreateUIlement <BlackPageManager>(blackPagePrefab, out _blackPageManager, UI.CanvasTipology.UI, ChangeTypeEnum.Modify, true);
                if (_blackPageManager)
                {
                    _blackPageManager.Disappear();
                }
            }
        }
Esempio n. 2
0
 public static void DestroyChild(this Transform @this, int index, bool immediate = false)
 {
     if (@this != null && @this.childCount > index)
     {
         GameObjectExtend.DestroyGameObject(@this.GetChild(index).gameObject, immediate);
     }
 }
 private void CreateGameManager()
 {
     if (!GameObject.FindObjectOfType <GameManager>())
     {
         GameObjectExtend.CreateGameObject(gameManager);
     }
 }
Esempio n. 4
0
        private void Update()
        {
            if (init && _timer != null && originTransform && (!useCurve || curve != null) && (!originUpdate || originTransform != null) && (!isTarget || targetTransform != null))
            {
                float percent = useCurve && curve != null?curve.Evaluate(_timer.TimeInPercent) : _timer.TimeInPercent;

                Vector3 pointA = originUpdate ? originTransform.position : _origin;
                Vector3 pointb = isTarget ? targetTransform.position : _destnation;

                Vector3 currentPosition = Vector3.Lerp(pointA, pointb, percent);

                if (agentTransform)
                {
                    agentTransform.position = currentPosition;
                }

                if (_timer.IsFinish())
                {
                    onFinish.Invoke(gameObject);
                    ResetTranslation();
                    if (destroyAtFinish)
                    {
                        GameObjectExtend.DestroyGameObject(gameObject);
                    }
                }
            }
        }
        protected GameObject FindObj()
        {
            _init = true;

            if (typeControl == StringTypeControl.Name && usePrefab)
            {
                if (!keysForFind.keys.IsAlmostSpecificCount())
                {
                    keysForFind.keys = new string[1];
                }
                keysForFind.keys[0] = prefabName.name;
            }


            if (useRoot)
            {
                if (rootTransform == null)
                {
                    if (useCanvas)
                    {
                        rootTransform = CanvasManager.GetChild(canvasTiplogy);
                    }
                    else
                    {
                        rootTransform = GameObjectExtend.Find <Transform>(typeControlRoot, keysForFindRoot.keys, isEqualCountTagsRoot);
                    }
                }

                return(GameObjectExtend.FindInHierarchy(typeControl, keysForFind.keys, rootTransform, includeInactiveChildren, isEqualCountTags));
            }
            else
            {
                return(GameObjectExtend.Find(typeControl, keysForFind.keys, isEqualCountTags));
            }
        }
 public void Stop()
 {
     _play = false;
     _timer.ResetOff();
     if (destoryAtFinish)
     {
         GameObjectExtend.DestroyGameObject(gameObject);
     }
 }
 public void DestroyAudioSource()
 {
     GameObjectExtend.DestroyGameObject(gameObject);
 }
Esempio n. 8
0
        private IEnumerator DetroyGameObject(float time)
        {
            yield return(new WaitForSeconds(time));

            GameObjectExtend.Destroy(gameObject);
        }
Esempio n. 9
0
 private void OnFinishTime(TimerContainer container, float left, float right)
 {
     GameObjectExtend.DestroyGameObject(gameObject);
 }