public override void InitializeStates(out BaseState default_state)
 {
     default_state = off;
     root.DoNothing();
     off.PlayAnim("off").EventTransition(GameHashes.OperationalChanged, on, (AutoMiner.Instance smi) => smi.GetComponent <Operational>().IsOperational);
     on.DefaultState(on.idle).EventTransition(GameHashes.OperationalChanged, off, (AutoMiner.Instance smi) => !smi.GetComponent <Operational>().IsOperational);
     on.idle.PlayAnim("on").EventTransition(GameHashes.ActiveChanged, on.moving, (AutoMiner.Instance smi) => smi.GetComponent <Operational>().IsActive);
     on.moving.Exit(delegate(AutoMiner.Instance smi)
     {
         smi.master.StopRotateSound();
     }).PlayAnim("working").EventTransition(GameHashes.ActiveChanged, on.idle, (AutoMiner.Instance smi) => !smi.GetComponent <Operational>().IsActive)
     .Update(delegate(AutoMiner.Instance smi, float dt)
     {
         smi.master.UpdateRotation(dt);
     }, UpdateRate.SIM_33ms, false)
     .Transition(on.digging, RotationComplete, UpdateRate.SIM_200ms);
     on.digging.Enter(delegate(AutoMiner.Instance smi)
     {
         smi.master.StartDig();
     }).Exit(delegate(AutoMiner.Instance smi)
     {
         smi.master.StopDig();
     }).PlayAnim("working")
     .EventTransition(GameHashes.ActiveChanged, on.idle, (AutoMiner.Instance smi) => !smi.GetComponent <Operational>().IsActive)
     .Update(delegate(AutoMiner.Instance smi, float dt)
     {
         smi.master.UpdateDig(dt);
     }, UpdateRate.SIM_200ms, false)
     .Transition(on.moving, GameStateMachine <States, AutoMiner.Instance, AutoMiner, object> .Not(RotationComplete), UpdateRate.SIM_200ms);
 }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = notready;
     root.Update(UpdateStatusItems, UpdateRate.SIM_200ms, false);
     notoperational.PlayAnim("off").TagTransition(GameTags.Operational, notready, false);
     notready.PlayAnim("off").EventTransition(GameHashes.OnStorageChange, ready, (SMInstance smi) => smi.IsReady()).TagTransition(GameTags.Operational, notoperational, true);
     ready.DefaultState(ready.free).ToggleReactable((SMInstance smi) => smi.master.reactable = new WashHandsReactable(smi.master.GetComponent <Work>(), Db.Get().ChoreTypes.WashHands, smi.master.GetComponent <DirectionControl>().allowedDirection)).TagTransition(GameTags.Operational, notoperational, true);
     ready.free.PlayAnim("on").WorkableStartTransition((SMInstance smi) => smi.GetComponent <Work>(), ready.occupied);
     ready.occupied.PlayAnim("working_pre").QueueAnim("working_loop", true, null).WorkableStopTransition((SMInstance smi) => smi.GetComponent <Work>(), notready);
 }
Beispiel #3
0
 public override void InitializeStates(out BaseState default_state)
 {
     default_state     = notready;
     base.serializable = true;
     notoperational.PlayAnim("off").TagTransition(GameTags.Operational, notready, false);
     notready.PlayAnim("off").EventTransition(GameHashes.OnStorageChange, ready, (SMInstance smi) => smi.HasSufficientMass()).TagTransition(GameTags.Operational, notoperational, true);
     ready.DefaultState(ready.free).ToggleReactable((SMInstance smi) => smi.master.reactable = new ScrubOreReactable(smi.master.GetComponent <Work>(), Db.Get().ChoreTypes.ScrubOre, smi.master.GetComponent <DirectionControl>().allowedDirection)).EventTransition(GameHashes.OnStorageChange, notready, (SMInstance smi) => !smi.HasSufficientMass())
     .TagTransition(GameTags.Operational, notoperational, true);
     ready.free.PlayAnim("on").WorkableStartTransition((SMInstance smi) => smi.GetComponent <Work>(), ready.occupied);
     ready.occupied.PlayAnim("working_pre").QueueAnim("working_loop", true, null).WorkableStopTransition((SMInstance smi) => smi.GetComponent <Work>(), ready);
 }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = disconnected;
     disconnected.PlayAnim("off").EventTransition(GameHashes.ConduitConnectionChanged, backedup, (SMInstance smi) => smi.HasValidConnections()).Enter(delegate(SMInstance smi)
     {
         smi.GetComponent <Operational>().SetActive(false, false);
     });
     backedup.PlayAnim("off").ToggleStatusItem(Db.Get().BuildingStatusItems.OutputPipeFull, (object)null).EventTransition(GameHashes.ConduitConnectionChanged, disconnected, (SMInstance smi) => !smi.HasValidConnections())
     .ParamTransition(outputBlocked, fillingInactive, GameStateMachine <States, SMInstance, FlushToilet, object> .IsFalse)
     .Enter(delegate(SMInstance smi)
     {
         smi.GetComponent <Operational>().SetActive(false, false);
     });
     filling.PlayAnim("off").Enter(delegate(SMInstance smi)
     {
         smi.GetComponent <Operational>().SetActive(true, false);
     }).EventTransition(GameHashes.ConduitConnectionChanged, disconnected, (SMInstance smi) => !smi.HasValidConnections())
     .ParamTransition(outputBlocked, backedup, GameStateMachine <States, SMInstance, FlushToilet, object> .IsTrue)
     .EventTransition(GameHashes.OnStorageChange, ready, (SMInstance smi) => smi.UpdateFullnessState())
     .EventTransition(GameHashes.OperationalChanged, fillingInactive, (SMInstance smi) => !smi.GetComponent <Operational>().IsOperational);
     fillingInactive.PlayAnim("off").Enter(delegate(SMInstance smi)
     {
         smi.GetComponent <Operational>().SetActive(false, false);
     }).EventTransition(GameHashes.OperationalChanged, filling, (SMInstance smi) => smi.GetComponent <Operational>().IsOperational)
     .ParamTransition(outputBlocked, backedup, GameStateMachine <States, SMInstance, FlushToilet, object> .IsTrue);
     ready.DefaultState(ready.idle).Enter(delegate(SMInstance smi)
     {
         smi.master.fillMeter.SetPositionPercent(1f);
         smi.master.contaminationMeter.SetPositionPercent(0f);
     }).PlayAnim("off")
     .EventTransition(GameHashes.ConduitConnectionChanged, disconnected, (SMInstance smi) => !smi.HasValidConnections())
     .ParamTransition(outputBlocked, backedup, GameStateMachine <States, SMInstance, FlushToilet, object> .IsTrue)
     .ToggleChore(CreateUrgentUseChore, flushing)
     .ToggleChore(CreateBreakUseChore, flushing);
     ready.idle.Enter(delegate(SMInstance smi)
     {
         smi.GetComponent <Operational>().SetActive(false, false);
     }).ToggleMainStatusItem(Db.Get().BuildingStatusItems.FlushToilet).WorkableStartTransition((SMInstance smi) => smi.master.GetComponent <ToiletWorkableUse>(), ready.inuse);
     ready.inuse.Enter(delegate(SMInstance smi)
     {
         smi.ShowContaminatedMeter();
     }).ToggleMainStatusItem(Db.Get().BuildingStatusItems.FlushToiletInUse).Update(delegate(SMInstance smi, float dt)
     {
         smi.UpdateDirtyState();
     }, UpdateRate.SIM_200ms, false)
     .WorkableCompleteTransition((SMInstance smi) => smi.master.GetComponent <ToiletWorkableUse>(), flushing)
     .WorkableStopTransition((SMInstance smi) => smi.master.GetComponent <ToiletWorkableUse>(), flushed);
     flushing.Enter(delegate(SMInstance smi)
     {
         smi.Flush();
     }).GoTo(flushed);
     flushed.EventTransition(GameHashes.OnStorageChange, fillingInactive, (SMInstance smi) => !smi.HasContaminatedMass()).ParamTransition(outputBlocked, backedup, GameStateMachine <States, SMInstance, FlushToilet, object> .IsTrue);
 }