예제 #1
0
#pragma warning disable 0108
        public static T GetComponent <T>(GamebaseGameObjectManager.GameObjectType gameObjectType)
        {
            if (false == GamebaseGameObjectManager.ContainsGameObject(gameObjectType))
            {
                return(default(T));
            }

            var gameObject = GamebaseGameObjectManager.GetGameObject(gameObjectType);

            return(gameObject.GetComponent <T>());
        }
        private static GamebaseCoroutineComponent GetCoroutineComponent(GamebaseGameObjectManager.GameObjectType gameObjectType, bool isMake = false)
        {
            GamebaseCoroutineComponent coroutineComponent = GamebaseComponentManager.GetComponent <GamebaseCoroutineComponent>(gameObjectType);

            if (null == coroutineComponent && true == isMake)
            {
                coroutineComponent = GamebaseComponentManager.AddComponent <GamebaseCoroutineComponent>(gameObjectType);
            }

            return(coroutineComponent);
        }
        public static void StopCoroutine(GamebaseGameObjectManager.GameObjectType gameObjectType, Coroutine routine)
        {
            GamebaseCoroutineComponent coroutineComponent = GetCoroutineComponent(gameObjectType);

            if (null == coroutineComponent)
            {
                return;
            }

            coroutineComponent.StopCoroutine(routine);
        }
예제 #4
0
        public static T AddComponent <T>(GamebaseGameObjectManager.GameObjectType gameObjectType) where T : Component
        {
            var gameObject = GamebaseGameObjectManager.GetGameObject(gameObjectType);

            var component = gameObject.GetComponent <T>();

            if (null != component)
            {
                return(component);
            }

            return(gameObject.AddComponent <T>());
        }
        public static Coroutine StartCoroutine(GamebaseGameObjectManager.GameObjectType gameObjectType, IEnumerator routine)
        {
            GamebaseCoroutineComponent coroutineComponent = GetCoroutineComponent(gameObjectType, true);

            return(coroutineComponent.StartCoroutine(routine));
        }
        public static Coroutine StartCoroutine(GamebaseGameObjectManager.GameObjectType gameObjectType, string methodName)
        {
            GamebaseCoroutineComponent coroutineComponent = GetCoroutineComponent(gameObjectType, true);

            return(coroutineComponent.StartCoroutine(methodName));
        }
        public static Coroutine StartCoroutine(GamebaseGameObjectManager.GameObjectType gameObjectType, string methodName, [DefaultValue("null")] object value)
        {
            GamebaseCoroutineComponent coroutineComponent = GetCoroutineComponent(gameObjectType, true);

            return(coroutineComponent.StartCoroutine(methodName, value));
        }