Пример #1
0
        public override void OnDestroyBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnDestroyBehaviour(hActorData, lstBehaviourData);

            if (!HasBehaviourInArray())
            {
                return;
            }

            for (int i = 0; i < m_arrBehaviour.Length; i++)
            {
                m_arrBehaviour[i]?.OnDestroyBehaviour(hActorData, lstBehaviourData);
            }
        }
Пример #2
0
        public override void OnLateUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnLateUpdateBehaviour(hActorData, lstBehaviourData);

            if (!HasBehaviourInArray())
            {
                return;
            }

            for (int i = 0; i < m_arrBehaviour.Length; i++)
            {
                var hBehaviour = m_arrBehaviour[i];
                if (hBehaviour != null && hBehaviour.isRunning)
                {
                    hBehaviour.OnLateUpdateBehaviour(hActorData, lstBehaviourData);
                }
            }
        }
Пример #3
0
        public override void OnStopBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (!isRunning)
            {
                return;
            }

            isRunning = false;

            if (!HasBehaviourInArray())
            {
                return;
            }

            for (int i = 0; i < m_arrBehaviour.Length; i++)
            {
                m_arrBehaviour[i]?.OnStopBehaviour(hActorData, lstBehaviourData);
            }
        }
Пример #4
0
        public override void OnUpdateBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            base.OnUpdateBehaviour(hActorData, lstBehaviourData);

            if (!HasBehaviourInArray())
            {
                return;
            }

            for (int i = 0; i < m_arrBehaviour.Length; i++)
            {
                var hBehaviour = m_arrBehaviour[i];
                if (hBehaviour == null)
                {
                    continue;
                }

                bool bRunning = false;

                if (hBehaviour.isRunning)
                {
                    if (!hBehaviour.PassCondition(hActorData, lstBehaviourData))
                    {
                        hBehaviour.OnStopBehaviour(hActorData, lstBehaviourData);
                    }
                    else
                    {
                        isRunning = true;
                    }
                }
                else if (hBehaviour.PassCondition(hActorData, lstBehaviourData))
                {
                    hBehaviour.OnStartBehaviour(hActorData, lstBehaviourData);
                    isRunning = true;
                }

                if (bRunning)
                {
                    hBehaviour.OnUpdateBehaviour(hActorData, lstBehaviourData);
                }
            }
        }
Пример #5
0
        public override void OnStartBehaviour(ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (isRunning)
            {
                return;
            }

            isRunning = true;

            if (!HasBehaviourInArray())
            {
                return;
            }

            for (int i = 0; i < m_arrBehaviour.Length; i++)
            {
                var hBehaviour = m_arrBehaviour[i];
                if (hBehaviour != null && hBehaviour.PassCondition(hActorData, lstBehaviourData))
                {
                    hBehaviour.OnStartBehaviour(hActorData, lstBehaviourData);
                }
            }
        }
Пример #6
0
        public static bool PassAllCondition(this DSC_ActorBehaviourCondition[] arrCondition, ActorData hActorData, List <IActorBehaviourData> lstBehaviourData)
        {
            if (arrCondition == null || arrCondition.Length <= 0)
            {
                return(true);
            }

            for (int i = 0; i < arrCondition.Length; i++)
            {
                var hCondition = arrCondition[i];
                if (hCondition != null && !hCondition.PassCondition(hActorData, lstBehaviourData))
                {
                    return(false);
                }
            }

            return(true);
        }