private void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); // time rewind setup states = new List <ChestTimeState>(); chestClosedEvent = new ChestClosedEvent(); chestOpenedEvent = new ChestOpenedEvent(); finishedOpeningTimer = gameObject.AddComponent <Timer>(); finishedOpeningTimer.AddTimerFinishedEventListener(FinishedOpeningTimerAction); reverseAudioManager = Camera.main.GetComponent <ReverseAudioManager>(); // setup events EventManager.AddChestOpenedInvoker(this); EventManager.AddChestClosedInvoker(this); }
void Awake() { // setup components rb2d = GetComponent <Rigidbody2D>(); camrb2d = mainCamera.GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); // setup events EventManager.AddChestOpenedListener(ChestOpenedAction); EventManager.AddChestClosedListener(ChestClosedAction); // time rewind states = new List <KnightTimeState>(); isKinematicInitially = rb2d.isKinematic; rewindAlertTextPrefab = Resources.Load("Menus/RewindMenu") as GameObject; reverseAudioManager = Camera.main.GetComponent <ReverseAudioManager>(); // setup timers keyAudioTimer = gameObject.AddComponent <Timer>(); keyAudioTimer.AddTimerFinishedEventListener(KeyAudioTimerAction); jumpOnEnemyTimer = gameObject.AddComponent <Timer>(); jumpOnEnemyTimer.AddTimerFinishedEventListener(JumpOnEnemyTimerAction); }