private void OnTriggerEnter(Collider other) { if (other.CompareTag("Structure")) { if (other.GetComponent <Renderer>().bounds.size.x < gameObjectLocalScale.x + 15f) { other.gameObject.SetActive(false); invoker.AddCommand(changeSize); invoker.InvokeCommand(); SoundEffectSource.clip = suckSound; SoundEffectSource.Play(); } else if (takeDamage) { invoker.InvokeUndoCommand(); SoundEffectSource.clip = damageSound; SoundEffectSource.Play(); takeDamage = false; counter = 0; if (invoker.IsGameLost()) { loseScreen.SetActive(true); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; Time.timeScale = 0; } } } }
// Update is called once per frame void FixedUpdate() { counter++; if (counter >= timePerEra / 0.02f) { invoker.AddCommand(changeEra); invoker.InvokeCommand(); counter = 0; } }