void Awake() { m_SpaceShipBehaviour = FindObjectOfType <SpaceShipBehaviour>(); m_PlayerHealth = m_SpaceShipBehaviour.GetComponent <Health>(); m_SpaceShipBehaviourTransform = m_SpaceShipBehaviour.transform; m_InfiniteLevelManager = FindObjectOfType <InfiniteLevelManager>(); m_ObjectSpawner = FindObjectOfType <ObjectSpawner>(); m_GUIManager = FindObjectOfType <GUIManager>(); m_State = State.Running; }
void Awake() { SpaceShipBehaviour spaceship = FindObjectOfType <SpaceShipBehaviour>(); if (spaceship != null) { m_PlayerHealth = spaceship.GetComponent <Health>(); } m_GameplayManager = FindObjectOfType <GameplayManager>(); m_InfiniteLevelManager = FindObjectOfType <InfiniteLevelManager>(); }
private void HitPlayer(SpaceShipBehaviour player) { Health playerHealth = player.GetComponent <Health>(); if (m_HealthToAddOnHit.HealthValue > 0) { PlayAudioManager.PlayHitIncrease(); } else { PlayAudioManager.PlayHitDecrease(); } playerHealth.HealthValue += m_HealthToAddOnHit.HealthValue; Destroy(this.gameObject); }