void Start() { lastPosition = gameObject.transform.position; defaultFog = RenderSettings.fog; defaultFogColor = RenderSettings.fogColor; defaultFogDensity = RenderSettings.fogDensity; defaultSkybox = RenderSettings.skybox; if (soundSource == null) { soundSource = GetComponent <AudioSource>(); } targetCam = GameObject.FindGameObjectWithTag(swimTowardCamLook).GetComponent <Camera>(); climbController = (climbController == null) ? GetComponent <ClimbController>() : climbController; moveController = (moveController == null) ? GetComponent <MovementController>() : moveController; weaponManager = (weaponManager == null) ? GetComponentInChildren <InvWeaponManager>() : weaponManager; }
void Start() { camHolder = GameObject.FindGameObjectWithTag("CameraHolder"); if (playerCam == null) { Debug.LogError("You must supply a player Camera to MovementController!"); } wm = GetComponentInChildren <InvWeaponManager>(); controller = GetComponent <CharacterController>(); myTransform = transform; speed = groundMovement.walkSpeed; rayDistance = controller.height * .5f + controller.radius; slideLimit = controller.slopeLimit - .1f; jumpTimer = jumping.antiBunnyHopFactor; if (anims.animators.Length < 1 || anims.animators[0] == null) { anims.animators[0] = this.GetComponent <Animator>(); } if (healthScript == null) { healthScript = this.GetComponent <Health> (); } }