protected void OnVisitorGetRandomLittleZooReply(Message msg) { var _msg = msg as VisitorGetRandomLittleZooReply; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; if (entity.entityID != _msg.entityID) { return; } DebugFile.GetInstance().WriteKeyFile(entity.entityID, " {0}", _msg); if (!_msg.result) { DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 申请失败,准备离开", entity.entityID); PrepareLeaveZoo(entity); return; } this.stayBuildingID = _msg.littleZooID; this.stayGroupID = _msg.groupID; DebugFile.GetInstance().WriteKeyFile(entity.entityID, " GetPath {0} -> {1}", entity.stayBuildingID, _msg.littleZooID); this.pathOfGotoLittleZoo = EntityVisitor.GetPath(entity.stayBuildingID, _msg.littleZooID); if (string.IsNullOrEmpty(pathOfGotoLittleZoo)) { string e = string.Format("{0}没有找到路{1} -> {2} !!!!!!!!!!", entity.entityID, entity.stayBuildingID, _msg.littleZooID); throw new System.Exception(e); } //LogWarp.LogFormat("动物栏{0}, 等待位获得成功, 排号{1}, 路径{2}", _msg.littleZooID, _msg.indexInQueue, pathOfGotoLittleZoo); if (this.isArrivedStartOfPath) { EntityVisitor.GodownPath(entity, pathOfGotoLittleZoo); return; } EntityVisitor.GotoStartOfPath(entity, pathOfGotoLittleZoo); }
public override void Enter(int preStateName) { base.Enter(preStateName); var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveFromZooEntry.Enter", entity.entityID); DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName); isArrivedStartOfPathTo1000 = false; isArrivedEndOfPathTo1000 = false; isToStateVisitorGotoGroundParking = false; var playdata = GlobalDataManager.GetInstance().playerData; entryBuildingID = GlobalDataManager.GetInstance().logicTableGroup.GetSingleBuildingID(playdata.playerZoo.currSceneID, BuildingType.EntryGate); entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed; MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, OnArrived); MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply); pathOfLeaveZoo = Config.globalConfig.getInstace().NaturalVisitorOut_1; //选当前所在位置到1000的路,走过去。 if (entity.stayBuildingID == entryBuildingID) { LogWarp.LogFormat("{0} 刚入口排队结束进入动物后就返回!", entity.entityID); isArrivedStartOfPathTo1000 = true; EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().EntryGoBackPath); return; } pathOfTo1000 = EntityVisitor.GetPath(entity.stayBuildingID, entryBuildingID); if (string.IsNullOrEmpty(pathOfTo1000)) { string e = string.Format("StateVisitorLeaveNonLittleZoo 没找到{0}->{1}的路!!!!", entity.stayBuildingID, 1000); throw new Exception(e); } EntityVisitor.GotoStartOfPath(entity, pathOfTo1000); }