private GameObject createPlayer(GeneticPlayer player) { GameObject result = GameObject.Instantiate(playerPrefab, mapContainer.transform); GeneticPlayerController playerController = result.GetComponent <GeneticPlayerController>(); playerController.Model = player; result.transform.position = new Vector3(playerController.Model.getPosX(), playerController.Model.getPosY(), -0.1f); return(result); }
void OnGUI() { if (showNextButton) { if (GUI.Button(new Rect(20, Screen.height - 40, 100, 20), "Next Alive")) { currTarget = findTarget(currtargetIndex + 1); } } }
private void LateUpdate() { if (currTarget == null || !(currTarget.alive && currTarget.enabled)) { currTarget = findTarget(currtargetIndex); } transform.position = currTarget.transform.position; if (Input.GetMouseButton(0)) { y = Input.GetAxis("Mouse X"); x = Input.GetAxis("Mouse Y"); //Debug.Log(x + ":" + y); rotateValue = new Vector3(x * -1, y, 0); //transform.eulerAngles = transform.eulerAngles - rotateValue; camera.transform.RotateAround(transform.position, rotateValue, cameraRotateSpeed * Time.deltaTime); } camera.transform.LookAt(transform.position); targetLastPos = currTarget.transform.position; }