Ferreteria/v2/class/ftExecutableTwig

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ferreteria‎ | v2‎ | class
Jump to: navigation, search

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();
}