void Update() { if (!PauseManager.paused && Input.GetKeyDown(KeyCode.Mouse0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMasks.groundLayerMask)) { ResourcesGetter.GetExplosion().transform.position = hit.point; } } }
public void Spawn() { //0.1f is the minimum time between spawns to prevent spawning too much and crash during testing :)) timeForNextSpawn = Mathf.Max(0.1f, 1f * spawningCurve.Evaluate(timeSinceStart / timeForMaxSpawn) * maxSpawnDelta); float angle = Random.Range(-180f, 180f); float randomDistance = Random.Range(50f, 60f); Vector3 spawnDelta = Quaternion.AngleAxis(angle, Vector3.up) * Vector3.forward * randomDistance; Vector3 pos = transform.position + spawnDelta; ResourcesGetter.GetEnemyCar().transform.position = pos; }