// Use this for initialization void Start() { mainCam = FindObjectOfType <CamScript>(); if (mainCam == null) { mainCam = Camera.main.gameObject.AddComponent <CamScript>(); } }
void Awake() { // Ensure the index of the cam container is the first // among its siblings. Other scripts rely on this! transform.SetSiblingIndex(0); camScript = transform.parent.parent.GetComponent <CamScript>(); canvas = GameObject.Find("Canvas"); }
ExtinguisherScript extinguisher; //used to control the extinguisher // Use this for initialization void Start() { health = GetComponent <HealthScript>(); health.initialize(maxHealth, maxHealth); cc = GetComponent <CharacterController> (); cam = Camera.main.GetComponent <CamScript> (); extinguisher = GetComponentInChildren <ExtinguisherScript> (); }
void Awake() { scoreManager = GameObject.FindGameObjectWithTag("ScoreManager").GetComponent <ScoreManager>(); gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CamScript>(); backgroundColor = GameObject.FindGameObjectWithTag("BackgroundColor").GetComponent <BackgroundColor>(); soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundManager>(); }
void Start() { rigid = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); camScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CamScript>(); scoreScript = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreScript>(); background = GameObject.FindGameObjectWithTag("Background").GetComponent <SpriteRenderer>(); Destroy(gameObject, killTime); }
void Start() { // create empty list of cars and networks cars = new List <GameObject>(); SpawnCars(carPopulation); ruleCar = Instantiate(carPrefab, carPrefab.transform.position, carPrefab.transform.rotation); ruleCar.SetActive(false); ruleCar.GetComponent <Controller>().useNN = false; ruleCar.GetComponent <RuleBased>().ruleBased = true; SetIDs(); camScript = cam.GetComponent <CamScript>(); camScript.car = cars[controllers[0].ID]; startPos = carPrefab.transform.position; startRotation = carPrefab.transform.rotation; }
void Start() { ShotTime = 100; cam = FindObjectOfType <CamScript>(); }
// Start is called before the first frame update void Start() { cs = GetComponent <CamScript>(); }
// Use this for initialization void Start() { player = FindObjectOfType <playerController>(); cam = FindObjectOfType <CamScript>(); // cameraZone = FindObjectOfType<CameraZoneScript>(); }
GameObject potato; //the current potato void Start() { launchable = true; camScript = Camera.main.GetComponent <CamScript> (); }
// Start is called before the first frame update void Start() { camScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CamScript>(); rigid = GetComponent <Rigidbody2D>(); }
// Use this for initialization void Start() { player = FindObjectOfType <playerController>(); cam = FindObjectOfType <CamScript>(); // camerazoneBox = GetComponent<BoxCollider2D>(); }
// Use this for initialization void Start() { cam = FindObjectOfType <CamScript>(); }
// Camera prefabs added to, removed from or swapped order in the scene // will update internally only once OnInspectorGUI() executes after // the modification. This happens when the Source Camera Controller // scene object is selected. public override void OnInspectorGUI() { serializedObject.Update(); DrawDefaultInspector(); CamScript cameraScript = ((CamScript)target); SerializedProperty sourceCameras = serializedObject.FindProperty("sourceCameras"); sourceCameras.arraySize = numCameras; // Add data for all cameras in the scene in the inspector, using default hotkeys for (int iCam = 0; iCam < numCameras; ++iCam) { // Add camera transforms and hotkeys in the inspector SerializedProperty tCamera = sourceCameras.GetArrayElementAtIndex(iCam).FindPropertyRelative("transform"); SerializedProperty hotkey = sourceCameras.GetArrayElementAtIndex(iCam).FindPropertyRelative("hotkey"); if (iCam == 0) { // Add the main camera first // Transform tCamera.objectReferenceValue = (Object)Camera.main.transform; // Hotkey if (hotkey.enumNames[hotkey.enumValueIndex] == "None") { hotkey.enumValueIndex = defaultBaseKeyCode; } } else { // Add other camera containers after the main camera // Transform tCamera.objectReferenceValue = (Object)cameraScript.transform.GetChild(iCam - 1); // Hotkey // If KeyCode.None, init with the base value (main camera hotkey) if (hotkey.enumValueIndex == 0) { hotkey.enumValueIndex = defaultBaseKeyCode; } // Keep increasing the hotkey index from Unity default (duplicated // from an earlier entry) until a free key is found. bool isDuplicateHotkey; do { isDuplicateHotkey = false; for (int jCam = 0; jCam < iCam; ++jCam) { // Debug.Log(sourceCameras.GetArrayElementAtIndex(jCam).FindPropertyRelative("hotkey").enumValueIndex + ", " + hotkey.enumValueIndex); if (hotkey.enumValueIndex == sourceCameras.GetArrayElementAtIndex(jCam). FindPropertyRelative("hotkey").enumValueIndex) // 0 == KeyCode.None { isDuplicateHotkey = true; ++hotkey.enumValueIndex; break; } } } while (isDuplicateHotkey); } } serializedObject.ApplyModifiedProperties(); }