public void Update() { //Debug.Log("AxisHorizontal:" + Input.GetAxis(m_HorizontaAxisName)); if (Input.GetAxis(m_HorizontaAxisName) != 0) { m_CarKinematics.Horizontal = Input.GetAxis(m_HorizontaAxisName); if (Time.time > _nextFire && m_Car.GetSpeed() < 15f) { //_nextFire = Time.time + 5f; //Transform arrow1 = Instantiate(_dust, _wheel[0].position, _wheel[0].rotation); //arrow1.GetComponent<ParticleSystem>().Play(); //Transform arrow2 = Instantiate(_dust, _wheel[1].position, _wheel[1].rotation); //arrow2.GetComponent<ParticleSystem>().Play(); } } if (Input.GetAxis(m_VerticalAxisName) != 0) { m_CarKinematics.Vertical = Input.GetAxis(m_VerticalAxisName); if (Time.time > _nextFire && m_Car.GetSpeed() < 15f) { _nextFire = Time.time + 5f; Transform arrow3 = Instantiate(_dust, _wheel[0].position, _wheel[0].rotation); arrow3.GetComponent <ParticleSystem>().Play(); Transform arrow4 = Instantiate(_dust, _wheel[1].position, _wheel[1].rotation); arrow4.GetComponent <ParticleSystem>().Play(); } } m_CarKinematics.Brake = Input.GetButton(m_BrakeButtonName); }
public void UpdateUI() { m_SpeedTextP1.text = m_CarP1.GetSpeed().ToString("0"); m_SpeedTextP2.text = m_CarP2.GetSpeed().ToString("0"); m_ScoreTextP1.text = score_p1.ToString("0"); m_ScoreTextP2.text = score_p2.ToString("0"); m_LifeTextP1.text = life_p1.ToString("0"); m_LifeTextP2.text = life_p2.ToString("0"); m_AmmoTextP1.text = ammo_p1.ToString("0"); m_AmmoTextP2.text = ammo_p2.ToString("0"); m_TimeText.text = (m_MaxTime - (Time.time - m_StartTime)).ToString("0"); }