Example #1
0
	private IEnumerator getobjs() {
		yield return new WaitForEndOfFrame();
		player = GameObject.Find("First Person Camera");
		playerChar = player.transform.parent.parent.GetComponent<FirstPersonCharacter>();
		//mainCam = player.GetComponent<Camera>();
        //activeCam = mainCam;
	}
 private static void Prefix(FirstPersonCharacter __instance)
 {
     // GOD MODE
     if (Manager.enabled_GodMode)
     {
         __instance.allowFallDamage = false;
     }
 }
 private static bool GetPlaceInput()
 {
     if (ForestVR.Enabled)
     {
         return(FirstPersonCharacter.GetDropInput());
     }
     return(TheForest.Utils.Input.GetButtonDown("Craft"));
 }
Example #4
0
 void Start()
 {
     allMouseRotationScripts = GetComponentsInChildren <SimpleMouseRotator>();
     controller = GetComponent <FirstPersonCharacter>();
     isPaused   = false;
     isAnimatingHeadAttachement = false;
     Screen.lockCursor          = true;
 }
Example #5
0
 // Use this for initialization
 void Start()
 {
     disabledOnSceneStart = false;
     eyes           = gameObject.GetComponent <Animation>();
     possMess       = GameObject.Find("Possession Master").GetComponent <PossessionMaster>();
     mouseRotatorLR = gameObject.GetComponent <SimpleMouseRotator>();
     mouseRotatorUD = gameObject.GetComponentsInChildren <SimpleMouseRotator>()[1];
     characterMover = gameObject.GetComponentInChildren <FirstPersonCharacter>();
 }
 private static void Postfix(FirstPersonCharacter __instance)
 {
     // MOVEMENT HACK
     if (Manager.enabled_MovementHack)
     {
         __instance.runSpeed      *= 2f;
         __instance.swimmingSpeed *= 2f;
     }
 }
Example #7
0
    private IEnumerator getobjs()
    {
        yield return(new WaitForEndOfFrame());

        player     = GameObject.Find("First Person Camera");
        playerChar = player.transform.parent.parent.GetComponent <FirstPersonCharacter>();
        //mainCam = player.GetComponent<Camera>();
        //activeCam = mainCam;
    }
 void Awake()
 {
     inst = this;
     // Set up a reference to the capsule collider.
     capsule           = collider as CapsuleCollider;
     grounded          = true;
     Screen.lockCursor = lockCursor;
     rayHitComparer    = new RayHitComparer();
 }
Example #9
0
    protected virtual void CharacterInit()
    {
        m_character = GetComponent <FirstPersonCharacter>();

        m_fpsCamera = FindObjectOfType <FirstPersonCamera>();
        //if (m_fpsCamera) m_fpsCamera.SetMainTarget(this.transform);

        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
    }
Example #10
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player") && this._state == RaftPush.States.Idle)
     {
         base.enabled = true;
         this._driver = LocalPlayer.FpCharacter;
         this._state  = RaftPush.States.DriverStanding;
         this._canLockIcon.gameObject.SetActive(true);
     }
 }
Example #11
0
 //if julia was disabled on the screen start we never get her component references
 //adding them here will grab them when we enable her
 void OnEnable()
 {
     if (disabledOnSceneStart)
     {
         eyes                 = gameObject.GetComponent <Animation>();
         mouseRotatorLR       = gameObject.GetComponent <SimpleMouseRotator>();
         mouseRotatorUD       = gameObject.GetComponentInChildren <SimpleMouseRotator>();
         characterMover       = gameObject.GetComponentInChildren <FirstPersonCharacter>();
         disabledOnSceneStart = false;
     }
 }
Example #12
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         FirstPersonCharacter component = other.gameObject.GetComponent <FirstPersonCharacter>();
         if (component && component.Grounded)
         {
             component.rb.mass = 0.1f;
         }
     }
 }
Example #13
0
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         FirstPersonCharacter component = other.gameObject.GetComponent <FirstPersonCharacter>();
         if (component)
         {
             component.rb.mass = component.defaultMass;
         }
     }
 }
Example #14
0
 private void Update()
 {
     if (SteamDSConfig.isDedicatedServer)
     {
         return;
     }
     if ((FirstPersonCharacter.GetDropInput() || (ForestVR.Enabled && TheForest.Utils.Input.GetButtonDown("Fire1") && !LocalPlayer.Inventory.DontShowDrop)) && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World)
     {
         this.PutDown(false, true, true, null);
     }
 }
Example #15
0
 private void Awake()
 {
     this.camRotator   = GameObject.FindWithTag("MainCamera").GetComponent <SimpleMouseRotator>();
     this.fps          = LocalPlayer.FpCharacter;
     this.animator     = base.transform.GetComponentInChildren <Animator>();
     this.setup        = base.GetComponentInChildren <playerScriptSetup>();
     this.walkSpeed    = this.fps.walkSpeed;
     this.runSpeed     = this.fps.runSpeed;
     this.strafeSpeed  = this.fps.strafeSpeed;
     this.camAnimation = this.camAnim.GetComponent <Animation>();
     this._rb          = base.GetComponent <Rigidbody>();
 }
Example #16
0
	bool prevGrounded = true;							// whether the character was grounded last frame


	// Use this for initialization
	void Start () {

		originalLocalPos = head.localPosition;
		character = GetComponent<FirstPersonCharacter>();
		if (audio == null)
		{
			// we automatically add an audiosource, if one has not been manually added.
			// (if you want to control the rolloff or other audio settings, add an audiosource manually)
			gameObject.AddComponent<AudioSource>();
		}
		prevPosition = rigidbody.position;
	}
Example #17
0
	bool prevGrounded = true;							// whether the character was grounded last frame


	// Use this for initialization
	void Start () {

		originalLocalPos = head.localPosition;
		character = GetComponent<FirstPersonCharacter>();
		if (GetComponent<AudioSource>() == null)
		{
			// we automatically add an audiosource, if one has not been manually added.
			// (if you want to control the rolloff or other audio settings, add an audiosource manually)
			gameObject.AddComponent<AudioSource>();
		}
		prevPosition = GetComponent<Rigidbody>().position;
	}
Example #18
0
    public static void InitializeClasses()
    {
        GameObject camObject = GameObject.Find("MainCamNew");

        scene        = FindObjectOfType <Scene>();
        mainCam      = camObject.GetComponent <Camera>();
        localPlayer  = FindObjectOfType <LocalPlayer>();
        playerStats  = FindObjectOfType <PlayerStats>();
        FPC          = FindObjectOfType <FirstPersonCharacter>();
        colorControl = FindObjectOfType <SceneColorControl_Anim>();


        init = false;
    }
Example #19
0
 private void OnPlay()
 {
     if (this.selected)
     {
         return;
     }
     Time.timeScale = 1f;
     FirstPersonCharacter[] array = UnityEngine.Object.FindObjectsOfType <FirstPersonCharacter>();
     for (int i = 0; i < array.Length; i++)
     {
         FirstPersonCharacter firstPersonCharacter = array[i];
         firstPersonCharacter.UnLockView();
     }
     this.MenuRoot.gameObject.SetActive(false);
 }
Example #20
0
 private void ShutDown()
 {
     this._driver.OffRaft();
     this._driver = null;
     this._state  = RaftPush.States.Idle;
     LocalPlayer.Transform.parent = null;
     LocalPlayer.AnimControl.controller.useGravity  = true;
     LocalPlayer.AnimControl.controller.isKinematic = false;
     LocalPlayer.AnimControl.controller.WakeUp();
     LocalPlayer.FpCharacter.enabled = true;
     LocalPlayer.FpCharacter.Locked  = false;
     LocalPlayer.MainRotator.resetOriginalRotation = true;
     LocalPlayer.MainRotator.enabled = true;
     LocalPlayer.AnimControl.playerCollider.enabled     = true;
     LocalPlayer.AnimControl.playerHeadCollider.enabled = true;
     LocalPlayer.CamRotator.rotationRange = new Vector2(170f, 0f);
     LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("paddleBool").Value = false;
     LocalPlayer.Animator.SetBoolReflected("paddleBool", false);
     this.stickToRaft = false;
     LocalPlayer.Transform.localEulerAngles = new Vector3(0f, LocalPlayer.Transform.localEulerAngles.y, 0f);
     this._canLockIcon.gameObject.SetActive(false);
     base.enabled = false;
 }
Example #21
0
 public void InitAbility(FirstPersonCharacter charac)
 {
     character = charac;
 }
 // Start is called before the first frame update
 void Start()
 {
     FirstPersonCharacter.instance = this;
 }
Example #23
0
 // Use this for initialization
 void Start()
 {
     character      = gameObject.GetComponent <FirstPersonCharacter>();
     showQuitWindow = false;
 }
Example #24
0
 private void Update()
 {
     if ((LocalPlayer.AnimControl.onRope || LocalPlayer.AnimControl.useRootMotion || LocalPlayer.AnimControl.onRockThrower || LocalPlayer.FpCharacter.drinking || LocalPlayer.AnimControl.holdingGirl) && this.Inventory.CurrentView == PlayerInventory.PlayerViews.Book)
     {
         this.ShouldOpenBook = false;
         this.CloseTheBook(false);
         return;
     }
     if (this.IsClosing)
     {
         if (!PlayerPreferences.CanUpdateFov)
         {
             if (!ForestVR.Enabled)
             {
                 LocalPlayer.MainCam.fieldOfView = Mathf.SmoothDamp(LocalPlayer.MainCam.fieldOfView, PlayerPreferences.Fov, ref this._fovChangeSpeed, 0.15f);
             }
             if (Mathf.Approximately(LocalPlayer.MainCam.fieldOfView, PlayerPreferences.Fov))
             {
                 this.IsClosing = false;
                 PlayerPreferences.CanUpdateFov = true;
             }
         }
     }
     else if (this.Inventory.CurrentView == PlayerInventory.PlayerViews.Book)
     {
         if ((!TheForest.Utils.Input.IsGamePad) ? TheForest.Utils.Input.GetButtonDown("Esc") : TheForest.Utils.Input.GetButtonDown("Back"))
         {
             this.CloseTheBook(false);
         }
         if (!PlayerPreferences.CanUpdateFov && !Mathf.Approximately(LocalPlayer.MainCam.fieldOfView, 65f) && !ForestVR.Enabled)
         {
             LocalPlayer.MainCam.fieldOfView = Mathf.SmoothDamp(LocalPlayer.MainCam.fieldOfView, 70f, ref this._fovChangeSpeed, 0.15f);
         }
         VirtualCursor.Instance.SetCursorType((!TheForest.Utils.Input.IsGamePad) ? VirtualCursor.CursorTypes.Arrow : VirtualCursor.CursorTypes.None);
     }
     if (this.ShouldOpenBook)
     {
         this.OpenBook();
     }
     if (this.LockPlace)
     {
         this.LockPlace = false;
     }
     else if (this.CreateMode)
     {
         if (!this.ShownPlace)
         {
             this.Grabber.ShowPlace();
             this.ShownPlace = true;
         }
         bool button = TheForest.Utils.Input.GetButton("Batch");
         if (Scene.HudGui.BatchPlaceIcon.activeSelf != button)
         {
             Scene.HudGui.BatchPlaceIcon.SetActive(button);
         }
         if ((!TheForest.Utils.Input.IsGamePad) ? TheForest.Utils.Input.GetButtonDown("Esc") : FirstPersonCharacter.GetDropInput())
         {
             this.CancelPlace();
         }
         else if (this._buildingPlacer.Clear && TheForest.Utils.Input.GetButtonDown("Build"))
         {
             this.PlaceGhost(button);
         }
     }
 }
Example #25
0
        public IEnumerator pickupGirlRoutine(Vector3 pos)
        {
            this.enablePlayerLocked();
            LocalPlayer.Animator.SetBool("girlPickup", true);
            this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
            this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
            float timer = 0f;

            this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
            while (this.currState2.shortNameHash != this.idleToGirlHash)
            {
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                LocalPlayer.Rigidbody.velocity = Vector3.zero;
                this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
                this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
                if (this.currState2.shortNameHash == this.idleToGirlHash)
                {
                    break;
                }
                yield return(null);
            }
            Animator girlAnimator = this.girlGo.GetComponentInChildren <Animator>();

            girlAnimator.enabled = true;
            if (BoltNetwork.isRunning)
            {
                syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Others);
                syncGirlPickup.playerTarget        = base.transform.root.GetComponent <BoltEntity>();
                syncGirlPickup.target              = this.girlGo.GetComponent <BoltEntity>();
                syncGirlPickup.syncPickupAnimation = true;
                syncGirlPickup.Send();
            }
            while (this.currState2.shortNameHash == this.idleToGirlHash)
            {
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                girlAnimator.Play("Base Layer.girlPickup", 0, this.currState2.normalizedTime);
                yield return(null);
            }
            girlAnimator.CrossFade("Base Layer.girlPickup", 0f, 0, 1f);
            if (this.girlGo)
            {
                this.girlHeld.SetActive(true);
                this.girlHeld.transform.parent = LocalPlayer.ScriptSetup.spine3.transform;
                if (!BoltNetwork.isRunning || this.girlGo.GetComponent <BoltEntity>().isOwner)
                {
                    UnityEngine.Object.Destroy(this.girlGo);
                }
                else
                {
                    syncGirlPickup syncGirlPickup2 = syncGirlPickup.Create(GlobalTargets.Others);
                    syncGirlPickup2.target        = this.girlGo.GetComponent <BoltEntity>();
                    syncGirlPickup2.destroyPickup = true;
                    syncGirlPickup2.Send();
                    this.girlGo = null;
                }
                this.disablePlayerLocked();
                timer = 0f;
                while (timer < 1f)
                {
                    LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer);
                    timer += Time.deltaTime * 3f;
                    yield return(null);
                }
                while (this.currState2.shortNameHash == this.girlIdleHash)
                {
                    LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                    this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.RightHand);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                    if (FirstPersonCharacter.GetDropInput() || (ForestVR.Enabled && TheForest.Utils.Input.GetButtonDown("Fire1")))
                    {
                        if (LocalPlayer.Animator.GetCurrentAnimatorStateInfo(0).tagHash == this.idleHash && !LocalPlayer.AnimControl.onRope && !LocalPlayer.AnimControl.onRaft && LocalPlayer.FpCharacter.Grounded && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Book && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Inventory)
                        {
                            base.StartCoroutine(this.putDownGirlRoutine());
                            yield break;
                        }
                        yield return(null);
                    }
                    yield return(null);
                }
            }
            else
            {
                LocalPlayer.Animator.SetBool("girlPickup", false);
                this.disablePlayerLocked();
                LocalPlayer.AnimControl.holdingGirl = false;
                LocalPlayer.Inventory.EquipPreviousWeapon(true);
                LocalPlayer.Inventory.ShowAllEquiped(true);
            }
            yield break;
        }
Example #26
0
 // Update is called once per frame
 void Update()
 {
     noteList = GameObject.FindObjectOfType <NoteSpawner>().foundNotes;
     noteList.Sort();
     character = gameObject.GetComponent <FirstPersonCharacter>();
 }
 private void Awake()
 {
     fpc          = GetComponent <FirstPersonCharacter>();
     charCollider = GetComponent <CapsuleCollider>();
     charRenderer = GetComponent <MeshRenderer>();
 }
Example #28
0
 public void InitAbility(FirstPersonCharacter character)
 {
     mCharacter = character;
 }
 void Start()
 {
     character = GameObject.FindObjectOfType <FirstPersonCharacter>();
 }
 // Use this for initialization
 void Start()
 {
     originalRotation = transform.localRotation;
     character        = GameObject.FindObjectOfType <FirstPersonCharacter>().GetComponent <FirstPersonCharacter>();
 }
Example #31
0
 public void Start()
 {
     fpc = owner.GetComponent <FirstPersonCharacter>();
 }