private void Start() { ownerTankAgent = owner.GetComponent <TankAgent>(); // If it isn't destroyed by then, destroy the shell after it's lifetime. Destroy(gameObject, m_MaxLifeTime); }
private void Start() { tankAgent = GetComponent <TankAgent>(); // The fire axis is based on the player number. m_FireButton = "Fire" + m_PlayerNumber; // The rate that the launch force charges up is the range of possible forces by the max charge time. m_ChargeSpeed = (m_MaxLaunchForce - m_MinLaunchForce) / m_MaxChargeTime; }
private bool m_Dead; // Has the tank been reduced beyond zero health yet? private void Awake() { tankAgent = GetComponent <TankAgent>(); // Instantiate the explosion prefab and get a reference to the particle system on it. m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent <ParticleSystem>(); // Get a reference to the audio source on the instantiated prefab. m_ExplosionAudio = m_ExplosionParticles.GetComponent <AudioSource>(); // Disable the prefab so it can be activated when it's required. m_ExplosionParticles.gameObject.SetActive(false); }