public void Fire() { if (!beamEffect.enabled) { RaycastHit hit; if (Physics.Raycast(shipCollider.gameObject.transform.position, shipCollider.gameObject.transform.TransformDirection(Vector3.forward), out hit, 500f)) { if (hit.collider.transform.parent.parent.gameObject.tag.Contains("Obstacle")) { Destroy(hit.collider.transform.parent.parent.gameObject); mediator.Score += 1; mediator.UpdateScore(mediator.Score); } } StartCoroutine("BeamEffect"); //Debug.DrawRay(shipCollider.gameObject.transform.position, shipCollider.gameObject.transform.TransformDirection(Vector3.forward) * 1000, Color.red, 10.0f); } }
public void StartGame() { Health = 3; Score = 0; DistanceTraveled = 0f; TimeElapsed = 0f; mediator.UpdateHealth(Health); mediator.UpdateScore(Score); mediator.UpdateDistance(DistanceTraveled); mediator.UpdateTime(TimeElapsed); PlayerRotation = 0f; mediator.SystemRotation = 0f; mediator.WorldRotation = 0f; mediator.CurrentPipe = mediator.SetupFirstPipe(); mediator.SetupCurrentPipe(); mediator.ShowBeam(false); SecondaryCamera.SetActive(false); Rotater.gameObject.SetActive(true); }