public Transform Anchor; // Объект, который будет показывать, в какой точке игрок покинет машину void Start() { // Выключаем логику машин UserCar.enabled = false; // Скрипт висит на игроке - говорим камере следить за ним Cam.SetTarget(transform); }
public void SetPlayerGO(object player) { if (player is GameObject) { GameObject target = (GameObject)player; camController.SetTarget(target.transform); } }
public void ActivateMenuOnUnit(UnitController unit) { currentUnit = unit; Camera.main.GetComponentInParent <CameraController>().enabled = false; AutoCam ac = Camera.main.GetComponentInParent <AutoCam>(); ac.enabled = true; ac.SetTarget(unit.transform); activeMenu.SetActive(true); }
private IEnumerator Start() { yield return(new WaitForSeconds(1)); camController = GetComponent <AutoCam>(); if (controllerSO.model.player != null) { camController.SetTarget(controllerSO.model.player.transform); } }
// Use this for initialization private void Start() { deathCanvas = Instantiate(deathCanvas); text = deathCanvas.GetComponent <DeathCanvas>().text; background = deathCanvas.GetComponent <DeathCanvas>().background; cam = Camera.main.transform.parent.transform.parent.GetComponent <AutoCam>(); cam.SetTarget(CamTarget); CamEndPosition = new Vector3(transform.position.x + CamEndPosition.x, transform.position.y + CamEndPosition.y, transform.position.z + CamEndPosition.z); beginTime = Time.time; textColor.a = textAlpha; text.color = textColor; backgroundColor.a = backgroundAlpha; background.color = backgroundColor; }
public void OnGameWin() { AllowMove = false; UIManager.GetInst().FadeImage.color = Color.white; var cg = UIManager.GetInst().FadeImage.GetComponent <CanvasGroup>(); cg.DOFade(1, 1.5f).OnComplete(() => { monster.gameObject.SetActive(false); autoCam.SetTarget(finalPlayer.transform); cg.DOFade(0, 0.5f); foreach (var door in FindObjectsOfType <Door>()) { door.CloseImmediately(); } finalPlayer.SetActive(true); ProgressManager.GetInst().OnWin(); gameObject.SetActive(false); }); }
private void ChangeCameraPosition(DisplayCamera dCamera) { if (dCamera.Transform != hmdCamera.transform) { if (headModel == null && headModelPrefab != null) { headModel = GameObject.Instantiate(headModelPrefab, hmdCamera.transform); } UnityEngine.XR.XRSettings.showDeviceView = false; vCamera.enabled = true; autoCam.SetTarget(dCamera.Transform); cameraRenderer.enabled = true; } else { UnityEngine.XR.XRSettings.showDeviceView = true; vCamera.enabled = false; cameraRenderer.enabled = false; } }
public void ResetCamera() { if (thisUI.selected.Count > 0) { camController.enabled = true; freeMove = false; Vector3 average = Vector3.zero; for (int i = 0; i < thisUI.selected.Count; i++) { average += thisUI.selected[i].location; } collection.transform.position = average / thisUI.selected.Count; camController.SetTarget(collection.transform); } else { camController.enabled = false; freeMove = true; } }
void SetTarget() { camera.SetTarget(cars[currentCarIndex].transform); CarController newCar = cars[currentCarIndex]; CarAIControl aiControl = newCar.GetComponent <CarAIControl>(); CarUserControl userControl = newCar.GetComponent <CarUserControl>(); if (aiControl) { aiControl.enabled = false; } if (userControl) { userControl.enabled = true; } if (currentCar) { aiControl = currentCar.GetComponent <CarAIControl>(); userControl = currentCar.GetComponent <CarUserControl>(); if (aiControl) { aiControl.enabled = true; } if (userControl) { userControl.enabled = false; } } currentCar = newCar; }
public void OnSpawn() { int alivePC = 0; int aliveAI = 0; int desiredPC = 1; int desiredAI = 7; foreach (Spawner spawner in spawners) { if (spawner.selfSpawn) { continue; } GameObject go = null; if (alivePC < desiredPC) { spawner.spawnType = SpawnType.ACTOR_PC; go = spawner.Spawn(); if (go != null) { autoCam.SetTarget(go.transform); alivePC++; } } else if (aliveAI < desiredAI) { spawner.spawnType = SpawnType.ACTOR_AI; go = spawner.Spawn(); if (go != null) { aliveAI++; } } } machine.SetState(GameState.ACTION); }
private void OnMouseDown() { camera.SetTarget(this.transform); //works. Debug.Log("clicked on : " + tile.ToString()); }
public void StartRace() { autoCam.SetTarget(player); }
public void ResetCamera() { cam.SetTarget(GameObject.Find("DefaultCameraTarget").transform); }
public void RTSwitch() { AutoCam ac = RTCam.GetComponent <AutoCam>(); ac.SetTarget(TheCar); }
/// <summary> /// Обработчик события спавна игрока /// </summary> /// <param name="_transform"></param> private void OnSpawnPlayer(Transform _transform) { autoCam.SetTarget(_transform); }