Пример #1
0
 public void InitNpc(List <NPCData> npcdata)
 {
     UpdateScneneFrame();
     npcdata.ForEach(p =>
     {
         GameObject npcObj  = GameObject.Instantiate(p.Prefab) as GameObject;
         EntityRole npcRole = npcObj.GetComponent <EntityRole>();
         npcRole.world      = this;
         buildingScene.AddIsoObject(npcRole);
         npcRole.transform.localScale = Vector3.one;
         npcRole.SetNodePosition(76, 98);
     });
 }
Пример #2
0
        public override void Enter(object param)
        {
            base.Enter(param);

            if (_owner.DesirePoint == null || _owner.AIMaster.nodePos == _owner.DesirePoint)
            {
                StrStateStatus = "MoveOver";
            }
            else
            {
                _owner.GameWorld.gridData.CalculateLinks();
                if (_owner.GameWorld.astar.FindPath(_owner.AIMaster.nodeX, _owner.AIMaster.nodeZ, (int)_owner.DesirePoint.x, (int)_owner.DesirePoint.y))
                {
                    //! 之后把Ball拆成Move组件
                    EntityRole ball = _owner.AIMaster.GetComponent <EntityRole>();
                    ball.MoveByRoads(_owner.GameWorld.astar.path);
                    ball.cbArrived = OnArrive;
                }
                else
                {
                    StrStateStatus = "MoveOver";
                }
            }
        }