private void MoveToRandomPosition() { // After we have shot, we move to a new random position gameObject.transform.position = PositionHelpers.GetRandomPosition(transform.position.y); // And then look towards the goal LookDirectionOfGoal(); }
public static IEnumerable <IQuestion> GetAllPossibleQuestions(IReadOnlyList <IQuestion> questions) { return (from addressedTo in PositionHelpers.AllPositions() from question in questions from answer in WordHelpers.AllWords() select new IsAnswerQuestion(addressedTo, question, answer)); }
public static IEnumerable <IQuestion> GetAllPossibleQuestions() { var positions = PositionHelpers.AllPositions(); var robots = RobotHelpers.AllRobots(); return (from robot in robots from position in positions from target in positions select new IsItQuestion(position, target, robot)); }
void Awake() { // GetComponent<LevelGenerator>().GenerateLevel(); for (int i = 0; i < zombieStartCount; i++) { Vector3 position = PositionHelpers.ComputeUnitPositionAroundTarget(new Vector3(0, 0, 0), i); Debug.Log(position); SpawnZombie(position); } mainCamera = Camera.main; cameraMovement = mainCamera.GetComponent <CameraMovement>(); cameraMovement.Target = zombies[0]; }
private void SpawnEntities(GameObject prefab, int count) { for (int i = 0; i < count; i++) { Vector3 spawnPosition = GetRandomWorldScreenCornerPosition(); spawnPosition = PositionHelpers.ComputeUnitPositionAroundTarget(spawnPosition, i + 1); while (Physics.OverlapSphere(spawnPosition, 1, LayerHelpers.NoGroundMask).Length > 0) { spawnPosition.x += 1; spawnPosition.z += 1; } Instantiate(prefab, spawnPosition, Quaternion.identity); } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonUp(1)) { Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray.origin, ray.direction, out hit)) { if (hit.collider.tag == "Ground") { int i = 0; foreach (GameObject zombie in zombies) { zombiesInfo[zombie].movement.SetNewDestination(PositionHelpers.ComputeUnitPositionAroundTarget(hit.point, i)); // zombiesMovements[i].SetNewDestination(ComputePositionAroundCenterZombie(hit.point, i)); i += 1; } } } } SpawnCivilians(); SpawnEnemies(); }