// Use this for initialization void Start() { mouse_look = transform.FindChild("direction").GetComponent <MouseLook2>(); mouse_look_camera = transform.FindChild("CameraFP").GetComponent <MouseLook>(); ShipScr = transform.FindChild("Ship").GetComponent <ShipScript>(); old_camera_rot = transform.rotation; }
void Start() { elevators = GameObject.FindGameObjectsWithTag("Elevator"); soundEffectManager = GameObject.FindWithTag("Main").GetComponent <SoundEffectManager>(); playerCharacterMotor = GameObject.FindWithTag("Player").GetComponent <CharacterMotor>(); playerMouseLook = GameObject.FindWithTag("Player").GetComponent <MouseLook2>(); stopAllElevator(); }
void Start() { maze = GameObject.FindWithTag("Main").GetComponent <MazeGenerator>(); lookAtPoint = GameObject.FindWithTag("LookAtPoint"); player = GameObject.FindWithTag("Player"); playerMentality = player.GetComponent <Mentality>(); playerCharacterMotor = player.GetComponent <CharacterMotor>(); playerMouseLook = player.GetComponent <MouseLook2>(); cameraShaker = GameObject.FindWithTag("Main").GetComponent <CameraShaker>(); soundEffectManager = GameObject.FindWithTag("Main").GetComponent <SoundEffectManager>(); soundEffectManager.adjustSound(); mainAudioSource = GameObject.FindWithTag("Main").GetComponent <AudioSource>(); bloodSplatter = GameObject.FindWithTag("Main").GetComponent <BloodSplatter>(); scoreboard = GameObject.FindWithTag("Main").GetComponent <Scoreboard>(); countDown = GameObject.FindWithTag("Main").GetComponent <CountDown>(); fadeOutAndFadeIn = Camera.main.GetComponent <FadeOutAndFadeIn>(); virtualPlayer = new GameObject(); virtualPlayer.name = "virtual player"; childrenRenderers = GetComponentsInChildren <Renderer>(); sphereCollider = GetComponent <SphereCollider>(); npcState = GetComponent <NPCState>(); npcState.state = NPCState.MAKING_DECISION; isInsane = false; isMoving = false; isCameraMoving = false; fakeBossPositionDelta = new Vector2(0, 0); if (GameMode.mode == GameMode.ESCAPING) { player.GetComponent <Compass>().enabled = false; } }
// Use this for initialization void Start() { playerName = "Player" + ++PlayerCount; /////////////////////////////////////////////////// // DO NOT TOUCH THIS PIECE OF CODE. IT SETS UP THE UI // IF YOU TRY TO DO IT IN ANY OTHER WAY, IT WILL JUST BREAK THE UI // IN UNEXPECTED WAYS if (isLocalPlayer) { spawnPoints = FindObjectsOfType <NetworkStartPosition>(); playerUiInstance = Instantiate(playerUiPrefab); playerUiInstance.transform.parent = this.gameObject.transform; playerAudioListenerInstance = Instantiate(playerAudioListenerPrefab, Vector3.zero, Quaternion.identity, this.gameObject.transform); } if (isClient) { spawnCamera = GameObject.FindGameObjectWithTag("SpawnScreenCamera").GetComponent <Camera>(); respawnWaitArea = GameObject.FindGameObjectWithTag("RespawnWaitArea").transform; playerUI = GetComponent <PlayerUIScript>(); playerUI.SetControllerReference(this); movement = GetComponent <MovementScript>(); mouseLook = GetComponent <MouseLook2>(); mouseLook.SetRespawnCamera(spawnCamera); hitmarkerTimer = hitmarkerRemoveAfterTime; CmdSetupAmmo(); } /////////////////////////////////////////////////// // This needs to be called on both the server and client gunInstances = new List <GameObject>(); hasGun = new List <bool>(); Transform weaponTransform = transform.Find("CameraController").Find("WeaponHolder"); int i = 0; foreach (Transform child in guns) { gunInstances.Add(child.gameObject); gunInstances[i].gameObject.SetActive(false); hasGun.Add(false); i++; } meleeInstance = Instantiate(meleeObject, weaponTransform.position, meleeObject.transform.rotation) as GameObject; meleeInstance.GetComponent <MeleeWeapon>().SetOwner(this); meleeInstance.gameObject.SetActive(false); meleeInstance.transform.parent = weaponTransform; gunInstances[0].gameObject.SetActive(true); gunInstances[0].GetComponent <BaseWeapon>().RefillAmmo(); hasGun[0] = true; isMeleeing = false; meleeTimer = meleeOutTime; canSwitchWeapon = true; weaponSwitchTimer = weaponSwithWaitTime; }