예제 #1
0
        /// <summary>
        /// 更新函数
        /// </summary>
        /// <param name="state">枚举的类型</param>
        /// <param name="dt">当前帧和上一帧的间隔时间</param>
        public void Update(CoroutineCtrEnum state, float dt)
        {
            switch (state)
            {
            case CoroutineCtrEnum.Default:
                _defaultCtr.Update(dt);
                break;

            case CoroutineCtrEnum.Wait:
                _waitTimeCtr.Update(dt);
                break;
            }
        }
예제 #2
0
        /// <summary>
        /// 将ator放入别的容器中
        /// </summary>
        /// <param name="ator">协程程序</param>
        /// <param name="changeTo">要加入的容器的枚举名</param>
        /// <returns>是否加入成功</returns>
        public bool ChangeTo(IEnumerator ator, CoroutineCtrEnum changeTo)
        {
            switch (changeTo)
            {
            case CoroutineCtrEnum.Default:
                _facade.SendMsg(MsgString.ChangeToDefault, ator);
                break;

            case CoroutineCtrEnum.Wait:
                _facade.SendMsg(MsgString.ChangeToWait, ator);
                break;
            }
            return(true);
        }
예제 #3
0
        /// <summary>
        /// 重新安置ator,如果需要被移除,函数内部会自动加入相对应的容器
        /// 并且会返回true, 这时候需要在外部手动从当前容器移除
        /// </summary>
        /// <param name="ator">需要被重新安置的程序</param>
        /// <param name="currentType">当前的type</param>
        /// <returns>如果需要被重新安置,返回true, 否则返回false</returns>
        public bool ResetAtor(IEnumerator ator, CoroutineCtrEnum currentType)
        {
            //不需要重置的情况
            if (null == ator.Current && CoroutineCtrEnum.Default == currentType)
            {
                return(false);
            }
            else if (ator.Current is WaitForSeconds && CoroutineCtrEnum.Wait == currentType)
            {
                return(false);
            }


            if (null == ator.Current)
            {
                _facade.SendMsg(MsgString.ChangeToDefault, ator);
            }
            else if (ator.Current is WaitForSeconds)
            {
                _facade.SendMsg(MsgString.ChangeToWait, ator);
            }

            return(true);
        }