コード例 #1
0
        public ICharacterState Step()
        {
            behaviour.Idle();
            findTargetCooldown.Update();
            idleDoneCooldown.Update();

            // If there's target, attack
            if (findTargetCooldown.Ready())
            {
                var target = behaviour.FindTarget();

                if (target != null)
                {
                    return(new AttackState(behaviour, character, target));
                }
            }

            // If havn't done idling, idle
            if (!idleDoneCooldown.Ready())
            {
                return(this);
            }

            // Otherwise patrol
            return(new PatrolState(behaviour, character));
        }