private void Update() { if (Input.GetMouseButtonDown(1)) { var position = GetScreenPlanePosition(Input.mousePosition); playerMech.MoveTo(position); moveMarker.transform.position = position; } if (Input.GetMouseButtonDown(0)) { var position = GetScreenPlanePosition(Input.mousePosition); playerMech.FireTo(position); fireMarker.transform.position = position; } ControlEnemyMechs(); CheckWinConditions(); if (stressTimer > 0) { stressTimer -= Time.deltaTime; sceneCamera.transform.localPosition = cameraPosition + Random.insideUnitSphere * stressTimer * 0.5f; } else { sceneCamera.transform.localPosition = cameraPosition; } }
private void MoveRandomDirection(MechController enemy) { var randomPosition = new Vector3(Random.Range(minFieldPoint.x, maxFieldPoint.x), 0, Random.Range(minFieldPoint.y, maxFieldPoint.y)); enemy.MoveTo(randomPosition); }