Exemple #1
0
        public void UpdateThink()
        {
            if (HasPlayer() || !_Owner.IsUnit())
            {
                return;
            }

            if (_Owner.GetUnit().IsDead || _Owner.GetUnit().IsDisposed)
            {
                return;
            }

            if (CurrentBrain != null && CurrentBrain.IsStart && !CurrentBrain.IsStop)
            {
                CurrentBrain.Think();
            }
        }
Exemple #2
0
        public void UpdateThink()
        {
            if (HasPlayer())
            {
                return;
            }

            if (_unit != null)
            {
                if (_unit is KeepNpcCreature.KeepCreature)
                {
                    KeepNpcCreature.KeepCreature npc = _unit as KeepNpcCreature.KeepCreature;
                    if (((npc.Z - npc.SpawnPoint.Z > 120 || npc.SpawnPoint.Z - npc.Z > 30)) || !npc.PointWithinRadiusFeet(npc.WorldSpawnPoint, 200))
                    {
                        ProcessCombatEnd();
                        return;
                    }
                }
            }

            if (CurrentBrain != null && CurrentBrain.IsStart && !CurrentBrain.IsStop)
            {
                CurrentBrain.Think();
                if (State == AiState.FIGHTING)
                {
                    CurrentBrain.Fight();
                }
            }

            Creature creature = _unit as Creature;

            if (creature == null || creature is Pet)
            {
                return;
            }

            if (!creature.PointWithinRadiusFeet(creature.WorldSpawnPoint, 200))
            {
                ProcessCombatEnd();
            }
        }