public override void Process(string scene, Object changeObj) { if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName || fsm.gameObject.name != _objectName) { return; } PlayerDataBoolTest pdBoolTest = fsm.GetState(_stateName).GetActionsOfType <PlayerDataBoolTest>()[0]; if (_playerdata) { pdBoolTest.boolName = _boolName; } else if (_altTest == null) { RandomizerBoolTest boolTest = new RandomizerBoolTest(_boolName, pdBoolTest.isFalse, pdBoolTest.isTrue); fsm.GetState(_stateName).RemoveActionsOfType <PlayerDataBoolTest>(); fsm.GetState(_stateName).AddFirstAction(boolTest); } else { FsmEvent trueEvent = pdBoolTest.isTrue; string trueName = trueEvent != null ? trueEvent.Name : null; FsmEvent falseEvent = pdBoolTest.isFalse; string falseName = falseEvent != null ? falseEvent.Name : null; fsm.GetState(_stateName).AddFirstAction( new RandomizerExecuteLambda(() => fsm.SendEvent( _altTest() ? trueName : falseName ))); fsm.GetState(_stateName).RemoveActionsOfType <PlayerDataBoolTest>(); } }
public override void Process(string scene, Object changeObj) { if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName || fsm.gameObject.name != _objectName) { return; } FsmState pdBool = fsm.GetState("PD Bool?"); FsmState charm = fsm.GetState("Charm?"); FsmState bigGetFlash = fsm.GetState("Big Get Flash"); // Remove actions that stop shiny from spawning pdBool.RemoveActionsOfType <StringCompare>(); // Change pd bool test to our new bool PlayerDataBoolTest boolTest = pdBool.GetActionsOfType <PlayerDataBoolTest>()[0]; if (_playerdata) { boolTest.boolName = _boolName; } else { RandomizerBoolTest randBoolTest = new RandomizerBoolTest(_boolName, boolTest.isFalse, boolTest.isTrue); pdBool.RemoveActionsOfType <PlayerDataBoolTest>(); pdBool.AddFirstAction(randBoolTest); } // Force the FSM to show the big item flash charm.ClearTransitions(); charm.AddTransition("FINISHED", "Big Get Flash"); // Set bool and show the popup after the flash bigGetFlash.AddAction(new RandomizerCallStaticMethod( typeof(BigItemPopup), nameof(BigItemPopup.ShowAdditive), _itemDefs, fsm.gameObject, "GET ITEM MSG END")); // Don't actually need to set the skill here, that happens in BigItemPopup // Maybe change that at some point, it's not where it should happen if (!_playerdata) { bigGetFlash.AddAction(new RandomizerSetBool(_boolName, true)); } // Exit the fsm after the popup bigGetFlash.ClearTransitions(); bigGetFlash.AddTransition("GET ITEM MSG END", "Hero Up"); bigGetFlash.AddTransition("HERO DAMAGED", "Finish"); }
public override void Process(string scene, Object changeObj) { if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName || fsm.gameObject.name != _objectName) { return; } FsmState pdBool = fsm.GetState("PD Bool?"); FsmState charm = fsm.GetState("Charm?"); FsmState bigGetFlash = fsm.GetState("Big Get Flash"); // Remove actions that stop shiny from spawning pdBool.RemoveActionsOfType <StringCompare>(); // Change pd bool test to our new bool PlayerDataBoolTest boolTest = pdBool.GetActionsOfType <PlayerDataBoolTest>()[0]; RandomizerBoolTest randBoolTest = new RandomizerBoolTest(_item, boolTest.isFalse, boolTest.isTrue); pdBool.RemoveActionsOfType <PlayerDataBoolTest>(); pdBool.AddFirstAction(randBoolTest); // Force the FSM to show the big item flash charm.ClearTransitions(); charm.AddTransition("FINISHED", "Big Get Flash"); //bigGetFlash.AddAction(new RandomizerExecuteLambda(() => RandoLogger.LogItemToTrackerByBoolName(logBoolName, _location))); //bigGetFlash.AddAction(new RandomizerExecuteLambda(() => RandoLogger.UpdateHelperLog())); //bigGetFlash.AddFirstAction(new RandomizerExecuteLambda(() => RandomizerMod.Instance.Settings.UpdateObtainedProgressionByBoolName(logBoolName))); // Set bool and show the popup after the flash bigGetFlash.AddAction(new RandomizerCallStaticMethod( typeof(BigItemPopup), nameof(BigItemPopup.ShowAdditive), _itemDefs, fsm.gameObject, "GET ITEM MSG END")); // Don't actually need to set the skill here, that happens in BigItemPopup // Maybe change that at some point, it's not where it should happen bigGetFlash.AddAction(new RandomizerExecuteLambda(() => GiveItem(_action, _item, _location))); // Exit the fsm after the popup bigGetFlash.ClearTransitions(); bigGetFlash.AddTransition("GET ITEM MSG END", "Hero Up"); bigGetFlash.AddTransition("HERO DAMAGED", "Finish"); }
public override void Process(string scene, Object changeObj) { if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName || fsm.gameObject.name != _objectName) { return; } PlayerDataBoolTest pdBoolTest = fsm.GetState(_stateName).GetActionsOfType <PlayerDataBoolTest>()[0]; if (_playerdata) { pdBoolTest.boolName = _boolName; } else { RandomizerBoolTest boolTest = new RandomizerBoolTest(_boolName, pdBoolTest.isFalse, pdBoolTest.isTrue); fsm.GetState(_stateName).RemoveActionsOfType <PlayerDataBoolTest>(); fsm.GetState(_stateName).AddFirstAction(boolTest); } }