コード例 #1
0
ファイル: WaypointMovement.cs プロジェクト: lyosky/CypherCore
        public override void DoInitialize(Creature owner)
        {
            RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Transitory | MovementGeneratorFlags.Deactivated);

            if (_loadedFromDB)
            {
                if (_pathId == 0)
                {
                    _pathId = owner.GetWaypointPath();
                }

                _path = Global.WaypointMgr.GetPath(_pathId);
            }

            if (_path == null)
            {
                Log.outError(LogFilter.Sql, $"WaypointMovementGenerator::DoInitialize: couldn't load path for creature ({owner.GetGUID()}) (_pathId: {_pathId})");
                return;
            }

            owner.StopMoving();

            _nextMoveTime.Reset(1000);

            // inform AI
            CreatureAI ai = owner.GetAI();

            if (ai != null)
            {
                ai.WaypointPathStarted(_path.id);
            }
        }