Ferreteria/v2/class/ftExecutableTwig

From Woozle Writes Code
< Ferreteria‎ | v2‎ | class
Revision as of 16:45, 22 May 2022 by Woozle (talk | contribs) (1 revision imported: moving this project here)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Page/code/class

Code

// PURPOSE: So a node can respond to events (does not pass them down to subnodes)
trait ftExecutableTwig {
    public function DoEvent($nEvent) {
	$this->OnEventDispatch($nEvent);
    }
    protected function OnEventDispatch($nEvent) {
	switch ($nEvent) {
	  case KI_NODE_EVENT_DO_BUILDING:
	    $this->OnCreateElements();
	    break;
	  case KI_NODE_EVENT_DO_FIGURING:
	    $this->OnRunCalculations();
	    break;
	}
    }
    abstract protected function OnCreateElements();
    abstract protected function OnRunCalculations();
}