public void ReleaseEntity(EntityMovable entity) { //清go var goPool = PoolManager.GetInstance().IsBelongGameObjectPool(entity.entityResType); goPool.OnRecovery(entity.mainGameObject); //清entity EntityFuncType eEntityFuncType = (EntityFuncType)entity.entityFuncType; switch (eEntityFuncType) { case EntityFuncType.CrossRoadCar: CrossRoadGame.EntityCrossRoadCar.pool.Delete(entity as CrossRoadGame.EntityCrossRoadCar); break; case EntityFuncType.Animal_LittleGame: EntityCrossRoadAnimal.pool.Delete(entity as CrossRoadGame.EntityCrossRoadAnimal); break; default: string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType); throw new System.Exception(e); } }
public void RemoveFromEntityMovables(EntityMovable entity) { DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} entityMovableRemoves.add {1}", entity.entityID, entity.mainGameObject.GetInstanceID()); DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} entityMovableRemoves.add {1}", entity.mainGameObject.GetInstanceID(), entity.entityID); this.entityMovableRemoves.Add(entity); }
public void Init(EntityMovable ownerEntity, Vector3 orgPos, float radius, float speed) { this.ownerEntity = ownerEntity; this.orgPos = orgPos; this.radius = radius; this.speed = speed; this.tarPos = Math_F.RandomInsideCircle(this.orgPos, this.radius); }
public void Release(EntityMovable entity) { //清go var goPool = PoolManager.GetInstance().IsBelongGameObjectPool(entity.entityResType); goPool.OnRecovery(entity.mainGameObject); //清entity EntityFuncType eEntityFuncType = (EntityFuncType)entity.entityFuncType; switch (eEntityFuncType) { case EntityFuncType.VisitorCar_EnterZoo: case EntityFuncType.VisitorCar_LeaveZoo: EntityVisitorCar.pool.Delete(entity as EntityVisitorCar); break; case EntityFuncType.Visitor_From_Car: case EntityFuncType.Visitor_From_Ship: case EntityFuncType.Visitor_From_GroundParking: EntityVisitor.pool.Delete(entity as EntityVisitor); break; case EntityFuncType.Animal_Wander: EntityAnimalWander.pool.Delete(entity as EntityAnimalWander); break; case EntityFuncType.Shuttle: EntityShuttle.pool.Delete(entity as EntityShuttle); break; case EntityFuncType.Ship: EntityShip.pool.Delete(entity as EntityShip); break; case EntityFuncType.Train: EntityShip.pool.Delete(entity as EntityShip); break; case EntityFuncType.GroundParkingCar: EntityGroundParkingCar.pool.Delete(entity as EntityGroundParkingCar); break; case EntityFuncType.CrossRoadCar: CrossRoadGame.EntityCrossRoadCar.pool.Delete(entity as CrossRoadGame.EntityCrossRoadCar); break; default: string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType); throw new System.Exception(e); } }
public void Init(EntityMovable ownerEntity, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed, bool isLoop) { if (this.IsRunning()) { string e = string.Format("{0}, {1}, {2} FollowPath非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.name, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } this.ownerEntity = ownerEntity; this.pathPosList = pathPosList; this.orgPos = orgPos; this.nextPosIdx = nextPosIdx; this.nextPos = this.pathPosList[this.nextPosIdx]; this.speed = speed; this.isLoop = isLoop; this.orgRotation = this.ownerEntity.mainGameObject.transform.rotation; this.isArrivedEnd = false; }
public virtual void Init(EntityMovable ownerEntity, int groupID, int idx, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) { if (this.IsRunning()) { string e = string.Format("{0} {1} FollowPathRightAngles非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } this.ownerEntity = ownerEntity; this.pathPosList = pathPosList; this.orgPos = orgPos; this.nextPosIdx = nextPosIdx; this.nextPos = this.pathPosList[this.nextPosIdx]; this.speed = speed * 0.001f; this.orgRotation = this.ownerEntity.mainGameObject.transform.rotation; this.isArrivedEnd = false; idxCtr = 0; //停止旋转CD turnCD.Stop(); this.turnSpeed = CalcTurnSpeed(this.speed); //因为知道角度是90度所以cd是旋转cd恒定的 turnCDVal = Math_F.FloatToInt(cornerAngle / this.turnSpeed); var pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(groupID, idx); if (!GroundParingSpacePathManager.IsExist(pathUnit.inPathRac)) { ctrList = GroundParingSpacePathManager.GenRAC(pathPosList, this.turnOffset); GroundParingSpacePathManager.GetInstance().AddPath( GroundParingSpacePathType.InPathRac, pathUnit, null, ctrList); } ctrList = pathUnit.inPathRac; this.groupID = groupID; this.idx = idx; isForward = true; //先把朝向转到第一个后点 ownerEntity.LookAt(ctrList[0].backPos); }
public void Init(EntityMovable ownerEntity, List <Vector3> pathPosList, float speed, float normalizedTime = 0) { if (this.IsRunning()) { string e = string.Format("{0}, {1}, {2} PathWander非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.name, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } if (pathPosList == null) { LogWarp.LogWarningFormat("[PathWander] 无法找到动物漫步路径, AnimalId={0}", ownerEntity.entityID); } this.pathData = new PathData() { vertices = pathPosList }; InitPath(ref pathData); this.ownerEntity = ownerEntity; this.speed = speed; this.normalizedSpeed = pathData.lenTotal > 0 ? speed / pathData.lenTotal : 0.1f; }
public virtual void Init(EntityMovable ownerEntity, string pathName, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) { if (this.IsRunning()) { string e = string.Format("{0} {1} FollowPathRightAngles非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.GetInstanceID()); throw new System.Exception(e); } this.ownerEntity = ownerEntity; this.pathPosList = pathPosList; this.pathName = pathName; this.orgPos = orgPos; this.nextPosIdx = nextPosIdx; this.nextPos = this.pathPosList[this.nextPosIdx]; this.speed = speed * 0.001f; this.orgRotation = this.ownerEntity.mainGameObject.transform.rotation; this.isArrivedEnd = false; idxCtr = 0; //停止旋转CD turnCD.Stop(); this.turnSpeed = CalcTurnSpeed(this.speed); //因为知道角度是90度所以cd是旋转cd恒定的 turnCDVal = Math_F.FloatToInt(cornerAngle / this.turnSpeed); ctrList = CalcPathManager.GetInstance().GetRac(pathName); if (ctrList == null) { ctrList = GenControllNodeList(pathPosList, this.turnOffset); CalcPathManager.GetInstance().AddRac(pathName, ctrList); } isForward = true; //先把朝向转到第一个后点 ownerEntity.LookAt(ctrList[0].backPos); }
//public override void Init(EntityMovable ownerEntity, List<Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) //{ // base.Init(ownerEntity, pathPosList, orgPos, nextPosIdx, speed); // AddState(); //} public override void Init(EntityMovable ownerEntity, int groupID, int idx, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed) { base.Init(ownerEntity, groupID, idx, pathPosList, orgPos, nextPosIdx, speed); AddState(); MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastLetGroundParingCarLeave, OnBroadcastLetGroundParingCarLeave); }