private void QuickChangeState(eStates newState) { try { currentState.ExitState(); currentState = states[(int)newState]; currentState.EnterState(); } catch (Exception e) { EmergencyExit(e); } }
public void Reset(CompanionsManager manager, string name) { this.manager = manager; this.companion = Game1.getCharacterFromName(name); this.states = new CompanionState[5]; this.states[0] = new ResetState(this); this.states[1] = new UnavailableState(this); this.states[2] = new AvailableState(this); this.currentState = new ResetState(this); script = ModEntry.modHelper.Content.Load <Dictionary <string, string> >("assets/" + name + "Companion.json", ContentSource.ModFolder); availabilityDays = (string[])(typeof(ModConfig).GetField(name).GetValue(ModEntry.config)); }
public void Dispose() { for (int i = 0; i < states.Length; i++) { states[i]?.ExitState(); } states = null; this.manager = null; this.companion = null; this.currentState = null; this.script.Clear(); this.script = null; this.availabilityDays = null; recruitDialogue = null; actionDialogue = null; locationDialogue = null; automaticDismissDialogue = null; }