Newer
Older
RxSprout / app / src / main / java / framework / scenario / ScenarioFSM.java
KeijuMatsumoto on 28 Nov 2017 584 bytes [add] Project
package framework.scenario;

import java.util.Hashtable;

public class ScenarioFSM extends FSM {
	ScenarioManager manager;
	
	public ScenarioFSM(State initialState, Hashtable<String, State> states, ScenarioManager manager) {
		super(initialState, states);
		this.manager = manager;
	}

	public boolean trans(Event e) {
		e = ((ScenarioState)currentState).canTrans(e);
		if (e == null) return false;
		ScenarioAction action = ((ScenarioState)currentState).getAction(e);
		boolean result = super.trans(e);
		manager.action(action, e, (ScenarioState)currentState);
		return result;
	}
}