protected void OnSpawnShuttle(Message msg) { var _msg = msg as SpawnShuttle; EntityShuttle entity = null; if (isRandomSpawn) { entity = EntityManager.GetInstance().GetRandomEntity( ResType.Shuttle, EntityFuncType.Shuttle) as EntityShuttle; } else { entity = EntityManager.GetInstance().GenEntityGameObject( 6001, EntityFuncType.Shuttle) as EntityShuttle; } DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "Shuttle_{0}", entity.entityID); EntityManager.GetInstance().AddToEntityMovables(entity); entity.SetVisistorList(_msg.shuttleVisitorList); if (entity.anim == null) { entity.anim = new SimpleAnimation(); } entity.anim.Init(entity.mainGameObject); entity.moveSpeed = Config.globalConfig.getInstace().ShuttleBaseSpeed; if (entity.followPath == null) { entity.followPath = new FollowPath(); } if (entity.fsmMachine == null) { entity.fsmMachine = new FSMMachineShuttle(entity); entity.fsmMachine.AddState(new StateShuttleGotoDynamicPath((int)ShuttleState.GotoDynamicPath, entity.fsmMachine)); entity.fsmMachine.AddState(new StateShuttleGotoCalcPath((int)ShuttleState.GotoCalcPath, entity.fsmMachine)); entity.fsmMachine.AddState(new StateShuttleGobackCalcPath((int)ShuttleState.GobackCalcPath, entity.fsmMachine)); entity.fsmMachine.AddState(new StateShuttleGobackDynamicPath((int)ShuttleState.GobackDynamicPath, entity.fsmMachine)); entity.fsmMachine.SetDefaultState((int)ShuttleState.GotoDynamicPath); } else { entity.fsmMachine.SetDefaultState((int)ShuttleState.GotoDynamicPath); } entity.Active(); TracedCamera(entity, isTracedCar); }
public override void Release() { ownerEntity = null; base.Release(); }
public FSMMachineShuttle(EntityShuttle ownerEntity) { this.ownerEntity = ownerEntity; }