Exemple #1
0
 public void Handle(SpawnEvent message)
 {
     //游戏单位建造事件
     //Debug.Log(message.getObject());//获取建造出来的单位
     //更多详细信息的话,比如
     if (message.hasRoadEnd())//对象是否是人,如果是人就会有目的地距离啥的
     {
         characterList.Add(message.getObject());
     }
     else
     {
         vehicleList.Add(message.getObject());
     }
     message.getDistance(delegate(float d) {
         print("距离 : " + d);
     });
     if (message.hasRoadEnd() && message.getObjectOwner() != owner)
     {
         //if (IDs.getIDByName(Tags.Character.GATEWORKER) == message.getObjectID()) {
         Vector3 tempv = message.getObject().GetComponent <Roadmovable>().getTargetPosition();
         print("坐标: " + tempv);
         if (tempv.z > 135)
         {
             gameID = IDs.getIDByName(Tags.Character.GUNNER);
             if (cdAndGoldIsOK(gameID))
             {
                 UnityEvent.UnityEventCenter.SendMessage <CreateUnitEvent>(new CreateUnitEvent(gameID, new Vector3(15.5f, 0, 13.2f) + subPos, owner, mineList[0]));
                 //  }
             }
         }
     }
 }