private Camera CreateNewCamera(bool isAi, ShipRefs r) { // create empty gameobject GameObject newCamera = new GameObject("Ship Camera"); newCamera.transform.parent = transform; // attach all components needed for cameras Camera c = newCamera.AddComponent <Camera>(); newCamera.AddComponent <GUILayer>(); newCamera.AddComponent <FlareLayer>(); newCamera.AddComponent <AudioListener>(); // render planes c.nearClipPlane = 0.05f; c.farClipPlane = 1500.0f; // ai switch if (isAi) { newCamera.SetActive(false); } else { RaceSettings.currentCamera = c; StartCamera sc = newCamera.AddComponent <StartCamera>(); sc.r = r; } return(c); }
void Start() { Cursor.visible = false; cam = Camera.main.GetComponent <StartCamera> (); startSize = Vector3.one; logoSize = Vector3.one; }
// Use this for initialization void Start() { soap = GameObject.FindWithTag("Player"); empty = GameObject.Find("CameraEmpty"); anchor = GameObject.Find("CameraAnchor"); sCam = GameObject.Find("StartCamera").GetComponent <StartCamera>(); transform.position = new Vector3(xOffset, yOffset, zOffset); anchor.transform.position = new Vector3(xOffset, yOffset, zOffset); maxDist = Vector3.Distance(empty.transform.position, anchor.transform.position); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void Start() { camEmpty = GameObject.Find("CameraEmpty"); respawn = GameObject.Find("Respawn"); respawn.transform.position = transform.position; startRot = transform.rotation; jumpTrigger = GameObject.Find("JumpTrigger"); jPos1 = GameObject.Find("JPos1"); jPos2 = GameObject.Find("JPos2"); moveDir = GameObject.Find("MovementDirection"); turnDir = GameObject.Find("TurnDirection"); rb = GetComponent <Rigidbody>(); bubbleTrigger = GameObject.Find("BubbleTrigger"); bubbleTrigger.SetActive(false); bubbleM = Resources.Load("universal_Prefabs/Suds") as GameObject; bub1 = GameObject.Find("Bubble1"); bub2 = GameObject.Find("Bubble2"); bub3 = GameObject.Find("Bubble3"); score = GameObject.Find("ScoreText").GetComponent <Text>(); points = 0; score.text = "Score: " + points; displayScore = points; halo = (Behaviour)gameObject.GetComponent("Halo"); controlsText = GameObject.Find("ControlsText").GetComponent <Text>(); totalScore = GameObject.Find("TotalScoreText").GetComponent <Text>(); totalTime = GameObject.Find("TotalTimeText").GetComponent <Text>(); exitText = GameObject.Find("ExitText").GetComponent <Text>(); lvl1Score = GameObject.Find("Level1Score").GetComponent <Text>(); lvl2Score = GameObject.Find("Level2Score").GetComponent <Text>(); lvl1Time = GameObject.Find("Level1Time").GetComponent <Text>(); lvl2Time = GameObject.Find("Level2Time").GetComponent <Text>(); GameObject[] btn = GameObject.FindGameObjectsWithTag("Button"); for (int i = 0; i < btn.Length; i++) { buttons.Add(btn[i].GetComponent <Button>()); } for (int i = 0; i < buttons.Count; i++) { if (buttons[i].name == "ResumeButton") { buttons[i].onClick.AddListener(NoStayInGame); } if (buttons[i].name == "MainMenuButton") { buttons[i].onClick.AddListener(delegate { AskFirst("menu"); }); } if (buttons[i].name == "RepeatLevelButton") { buttons[i].onClick.AddListener(delegate { AskFirst("restart"); }); } if (buttons[i].name == "YesButton") { buttons[i].onClick.AddListener(YesToQuestion); } if (buttons[i].name == "NoButton") { buttons[i].onClick.AddListener(NoToQuestion); } if (buttons[i].name == "EndMainMenuButton") { buttons[i].onClick.AddListener(ReturnToMenu); } if (buttons[i].name == "EndRepeatLevelButton") { buttons[i].onClick.AddListener(RestartLevel); } } scoresMenu = GameObject.Find("ScoresMenu"); choiceMenu = GameObject.Find("ExitMenu"); gameEnd = GameObject.Find("GameEnd"); pauseMenu = GameObject.Find("PauseMenu"); blackScreen = GameObject.Find("BlackScreen"); gameEndText = GameObject.Find("EndText").GetComponent <Text>(); pauseMenu.SetActive(false); gameEnd.SetActive(false); choiceMenu.SetActive(false); scoresMenu.SetActive(false); blackScreen.SetActive(false); canvas = GameObject.Find("MainMenuCanvas").GetComponent <Canvas>(); canvas.enabled = false; bigPointsCounter = GameObject.Find("BigPointsCounter").GetComponent <Text>(); bigPointsDisplay = GameObject.Find("BigPointsDisplay"); bigPointsText = bigPointsDisplay.GetComponent <Text>(); displayLight = bigPointsDisplay.GetComponent <Light>(); buildIndex = SceneManager.GetActiveScene().buildIndex; timer = GameObject.Find("TimerText").GetComponent <TimerSystem>(); cam = GameObject.Find("Main Camera").GetComponent <CameraMouseMovement>(); sCam = GameObject.Find("StartCamera").GetComponent <StartCamera>(); bigPointsCounter.text = "Big Points Collected:\n0 / " + sCam.points.Length; bigPointsText.text = "0 / " + sCam.points.Length; controlsText.enabled = false; }