// Start is called before the first frame update void Start() { m_sceneManager = GameObject.Find("SceneManager").GetComponent <SceneManager>(); m_waveManager = GameObject.Find("Singletons").GetComponent <WaveManager>(); m_objective = GameObject.Find("Objective").GetComponent <RepairObjective>(); if (m_objective == null) { Debug.LogError("No objective in scene. Place objective along with objective locations"); } //Death and Hurt animation event hookup if (m_Health != null && m_playerAnimation != null) { m_Health.onDamaged.AddListener(m_playerAnimation.SetHurtTrue); m_Health.onDeath.AddListener(m_playerAnimation.SetAliveFalse); m_Health.onDeath.AddListener(m_sceneManager.IncrementPlayerDeath); } if (m_cameraController != null) { m_cameraController.controllerIndex = this.controllerIndex; m_cameraController.useKeyboard = useKeyboard; } if (m_playerController != null) { m_playerController.controllerIndex = this.controllerIndex; m_playerController.useKeyboard = useKeyboard; } if (m_HandController != null) { m_HandController.controllerIndex = this.controllerIndex; } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag(tagToDepositOn)) { RepairObjective repairObj = other.gameObject.GetComponentInParent <RepairObjective>(); if (repairObj != null) { repairObj.DepositMaterial(); Destroy(gameObject); } } }