void Start() { DummyTestGameManager ImpactHandler = DummyTestGameManager.Instance; // get the singleton instance of the DummyTestGameManager //ImpactHandler.onRightImpact += ImpactHandlerOnRightImpact; // Subscribe to the event "OnrightImpact" //ImpactHandler.onLeftImpact += ImpactHandlerOnLeftImpact; // Subscribe to the event "OnleftImpact" player = GameObject.FindGameObjectWithTag("Player"); //the reference to player to add force on impact }
} // The get property of the singleton private void Awake() { if (instance != null && instance != this) //eliminate all duplicates of DummyTestGameManager instance { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(this.gameObject); } GetComponent <PlayerInput>().onActionTriggered += DummyTestGameManagerOnActionTriggered; //receive all action triggers from player input }