class Event {
  String functionName; // the name of what I will execute.
  String alertName; // Either I advance to the next event from something having happened, or...
  float timeUntilNextEvent; // ...or I just advance after a delay.
  
  Event(String FunctionName, float Delay) {
    functionName = FunctionName;
    timeUntilNextEvent = Delay;
    alertName = ""; // no alert.
  }
  Event(String FunctionName, String AlertName) {
    functionName = FunctionName;
    timeUntilNextEvent = -1; // no delay
    alertName = AlertName;
  }
  
//  boolean shouldTriggerImmediately() {
//    return timeUntilExecute==-1 && alertName==null;
//  }
  
  void update() {
    // Countdown, maybe!
    if (timeUntilNextEvent >= 0) {
      timeUntilNextEvent -= deltaTime;
      if (timeUntilNextEvent <= 0) {
        onEventEnded(null);
      }
    }
  }
  
  void alert(String alertThatHappened, String howItHappened) {
    if (alertThatHappened.equals(alertName)) {
      onEventEnded(howItHappened);
    }
  }
  
  
  void onEventEnded(String howItEnded) {
    sequenceController.executeNextEvent(howItEnded);
  }
  void execute(String howLastEventEnded) {
    currentScene.executeEventByName(functionName, howLastEventEnded);
  }
  
}

