// Use this for initialization void Start() { warpPS = transform.parent.gameObject; warpPSAnimator = warpPS.GetComponent <Animator>(); ps = warpPS.GetComponent <ParticleSystem>(); playerController = GameObject.Find("/Player").GetComponent <PlayerController>(); cameraObject = GameObject.Find("/Player/FirstPerson/Camera"); monitorController = GameObject.Find("/Rooms/Room3/Monitor4").GetComponent <TV_AnimationController>(); cameraController = cameraObject.GetComponent <FPCameraController>(); }
// Use this for initialization void Start() { // check for type by existing animator component tvAnimator = GetComponent <Animator>(); if (tvAnimator != null) { // game object is TV audioController = GetComponent <AudioController>(); timeText = transform.Find("Canvas").Find("Text").GetComponent <Text>(); timeText.enabled = false; } else if (GetComponent <Collider>() != null) { // game object is trigger playerObject = GameObject.Find("Player"); parentController = transform.parent.GetComponent <TV_AnimationController>(); } else { // game object is none of the above >> remove this script Debug.Log("TV_AnimationController hängt weder an einem TV noch an einem TriggerCollider"); Destroy(this); } }