public override void Enter(int preStateName) { base.Enter(preStateName); var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveZooEntryQueueFull.Enter", entity.entityID); DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName); entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed; MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived); MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply); //走回去的路,广告游客(ship)没有停车场逻辑,地下游客走地下, 地上游客走申请 EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType); switch (entityFuncType) { case EntityFuncType.Visitor_From_Ship: EntityVisitor.GodownPath(entity, PathManager.GetInstance().GetPath( Config.globalConfig.getInstace().AdvertVisitorOut)); break; case EntityFuncType.Visitor_From_Car: //这里没有走申请,得发个消息,让底下停车场数量-1 MessageInt.Send((int)GameMessageDefine.DirectMinusOneUnderParkingNum, entity.entityID); EntityVisitor.GodownReversePath(entity, Config.globalConfig.getInstace().EntryQueueObservePath); break; case EntityFuncType.Visitor_From_GroundParking: VisitorWhereLeaveFromApply.Send(entity.entityID); break; default: string e = string.Format("没有这种游客类型{0}", entityFuncType); throw new System.Exception(e); } //生成愤怒表情 var pool = PoolManager.GetInstance().GetGameObjectPool(9301); expGo = pool.New(); expTrans = expGo.transform; expTrans.position = entity.position; ExpressionScaleAnim(expTrans, Config.globalConfig.getInstace().ExpressionScaleOrg, Config.globalConfig.getInstace().ExpressionScaleMax, Config.globalConfig.getInstace().ExpressionScaleDuration, Config.globalConfig.getInstace().ExpressionDuration); }
protected void OnArrived(Message msg) { var _msg = (MessageArrived)msg; var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; //自己的entity if (_msg.followPath.ownerEntity.entityID != entity.entityID) { return; } var entityFuncType = (EntityFuncType)entity.entityFuncType; //到达离开的起点,向1000走 if (_msg.followPath.isArrivedEnd && !isArrivedStartOfPathTo1000) { isArrivedStartOfPathTo1000 = true; EntityVisitor.GodownPath(entity, pathOfTo1000); return; } //向动物园外走(已经走到1000了) if (_msg.followPath.isArrivedEnd && !isArrivedEndOfPathTo1000) { DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 往回走", entity.entityID); isArrivedEndOfPathTo1000 = true; //switch(entityFuncType) //{ // case EntityFuncType.Visitor_From_Ship: // EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().AdvertVisitorLeavePath); // break; // case EntityFuncType.Visitor_From_Car: // EntityVisitor.GodownPath(entity, pathOfLeaveZoo); // break; // case EntityFuncType.Visitor_From_GroundParking: // EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().GroundParkingVistorBasePath); // break; // default: // string e = string.Format("没有这种游客类型{0}", entityFuncType); // throw new System.Exception(e); //} //如果是广告游客直接离开 //非广告游客请求是从地面还是地下走 switch (entityFuncType) { case EntityFuncType.Visitor_From_Ship: EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().AdvertVisitorLeavePath); break; case EntityFuncType.Visitor_From_Car: case EntityFuncType.Visitor_From_GroundParking: VisitorWhereLeaveFromApply.Send(entity.entityID); break; default: string e = string.Format("没有这种游客类型{0}", entityFuncType); throw new System.Exception(e); } return; } if (_msg.followPath.isArrivedEnd) { //LogWarp.Log("结束离开"); //DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 回收", entity.entityID); //EntityManager.GetInstance().RemoveFromEntityMovables(entity); ////通知生成离开的汽车 //if (entity.entityFuncType == (int)EntityFuncType.Visitor_From_Car) //{ // MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo); //} //switch (entityFuncType) //{ // case EntityFuncType.Visitor_From_Car: // //EntityManager.GetInstance().RemoveFromEntityMovables(entity); // ////通知生成离开的汽车 // //MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo); // //break; // case EntityFuncType.Visitor_From_GroundParking: // //转向走向地面停车场 // //isToStateVisitorGotoGroundParking = true; // VisitorWhereLeaveFromApply.Send(entity.entityID); // break; // case EntityFuncType.Visitor_From_Ship: // EntityManager.GetInstance().RemoveFromEntityMovables(entity); // break; // default: // string e = string.Format("没有这种游客类型{0}", entityFuncType); // throw new System.Exception(e); //} //地下游客清除自己,通知生成离开的车 //广告游客清除自己 //地上游客,不可能,是异常 switch (entityFuncType) { case EntityFuncType.Visitor_From_Ship: EntityManager.GetInstance().RemoveFromEntityMovables(entity); break; case EntityFuncType.Visitor_From_Car: DebugFile.GetInstance().WriteKeyFile("FromUnder_", "{0}", entity.entityID); EntityManager.GetInstance().RemoveFromEntityMovables(entity); ////通知生成离开的汽车 MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo); break; default: string e = string.Format("这里不可能出现这种游客类型{0}", entityFuncType); throw new System.Exception(e); } } }