コード例 #1
0
        public void LogicUpdate(int deltaTime)
        {
            if (timinIdleState)
            {
                idleTime += deltaTime;

                DebugUtils.Assert(ownerSkills.ContainsKey(UnitSkillTriggerType.OnPersistentIdleState), "UnitSkillHandler didn't register skill trigger OnPersistentIdleState, but still trigger it");

                List <SkillHandler> skills = ownerSkills[UnitSkillTriggerType.OnPersistentIdleState];
                for (int i = 0; i < skills.Count; i++)
                {
                    SkillHandler skill = skills[i];

                    int triggerValue = Mathf.RoundToInt(skill.triggerValue);
                    if (idleTime > triggerValue)
                    {
                        ExecuteSkill(skill);
                        idleTime = 0;
                    }
                }
            }

            if (timingResetMoveDistance)
            {
                if (!owner.InWalkState() && !owner.InChaseState())
                {
                    moveDistance = 0;
                }
            }

            // receive the attack event will reset restoreTargetTimer
            if (timingClearTarget)
            {
                if (restoreTargetTimer > restoreTargetTimeLimit)
                {
                    restoreTargetTimer = 0;
                    lastTarget         = null;
                }
                else
                {
                    restoreTargetTimer += deltaTime;
                }
            }

            TimingSkillCD(deltaTime);
        }