diff options
Diffstat (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Camera')
5 files changed, 155 insertions, 5 deletions
diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs new file mode 100644 index 0000000..46dc7fd --- /dev/null +++ b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Rigging +{ + + public class CameraManager : MonoBehaviour + { + // Start is called before the first frame update + void Start() + { + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = false; + } + + } + + +}
\ No newline at end of file diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs.meta b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs.meta new file mode 100644 index 0000000..2685dde --- /dev/null +++ b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb842cd2348a82a4da482f35c434de80 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraMovement.cs b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraMovement.cs index c988991..dd21770 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraMovement.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Camera/CameraMovement.cs @@ -1,23 +1,121 @@ +using Rigging.BodyPart; +using Rigging.Data; using System.Collections; using System.Collections.Generic; using UnityEngine; -namespace Rigging.Camera +namespace Rigging.Cameras { public class CameraMovement : MonoBehaviour { - // Start is called before the first frame update - void Start() + public Camera camera; + + public Transform positionTarget; + + //public Transform headPosition; + + public Transform rotationTarget; + + //public Transform bobberTarget; + + private StandingDataHandler standingData; + + private float fallingValue; + + private float fallingEffectValue; + + private float minBobble = 0.02f; + + public bool ADS; + + //public DamageEffects effects; + + //private WeaponHandler weaponHandler; + + private Rigidbody hip; + + //private HasControl hasControl; + + //private HeadCollisionHandler headCollisionHandler; + + private MovementDataHandler movementData; + + private Rigidbody torso; + + //private PlayerDeath death; + + private Strength str; + + private Vector3 cameraCurrentRelativeADSPosition = Vector3.zero; + + private Vector3 movementADSVelocity = Vector3.zero; + + private Vector3 ADSMovementPosition = Vector3.zero; + + private void Start() { + torso = base.transform.root.GetComponentInChildren<Torso>().GetComponent<Rigidbody>(); + //headCollisionHandler = base.transform.root.GetComponentInChildren<HeadCollisionHandler>(); + standingData = base.transform.root.GetComponentInChildren<StandingDataHandler>(); + movementData = base.transform.root.GetComponentInChildren<MovementDataHandler>(); + //weaponHandler = base.transform.GetComponentInParent<WeaponHandler>(); + camera = GetComponentInChildren<Camera>(); + hip = base.transform.root.GetComponentInChildren<Hip>().GetComponentInChildren<Rigidbody>(); + //hasControl = base.transform.root.GetComponent<HasControl>(); + //death = base.transform.root.GetComponent<PlayerDeath>(); + str = base.transform.root.GetComponentInChildren<Strength>(); + //effects = base.transform.root.GetComponent<DamageEffects>(); + } + private void LateUpdate() + { + //headCollisionHandler.collisionValue = 0f; + if (standingData.sinceLanded > 1f) + { + fallingValue = Mathf.Clamp(standingData.sinceGrounded - 0.5f, 0f, 10f) * 0.5f; + } + if (standingData.sinceGrounded > 0.5f || standingData.sinceLanded < 0.5f) + { + fallingEffectValue = Mathf.Lerp(fallingEffectValue, fallingValue, Time.smoothDeltaTime * 15f); + } + else + { + fallingEffectValue = Mathf.Lerp(fallingEffectValue, minBobble, Time.smoothDeltaTime * 3f); + } + Vector3 position = positionTarget.position; + base.transform.position = position; + base.transform.rotation = rotationTarget.rotation; + SetCameraPosition(); } - // Update is called once per frame - void Update() + private void SetCameraPosition() { + camera.transform.localPosition = Vector3.Lerp(camera.transform.localPosition, Vector3.zero, Time.deltaTime * 20f); + camera.fieldOfView = Mathf.Lerp(camera.fieldOfView, 90f, Time.deltaTime * 20f); + } + private void FixedUpdate() + { } + + private void Update() + { + //if (hasControl.hasControl) + //{ + // ADSMovementPosition += movementADSVelocity * Time.deltaTime; + //} + } + + //private float GetPhysicsValue() + //{ + // float result = fallingEffectValue * 0.3f + (1f - str.strength) + effects.damageValue; + // if (death.dead) + // { + // result = 1f; + // } + // return result; + //} } }
\ No newline at end of file diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs b/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs new file mode 100644 index 0000000..50a5a7e --- /dev/null +++ b/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace Rigging +{ + + public class RotationTarget : MonoBehaviour + { + } + +} diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs.meta b/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs.meta new file mode 100644 index 0000000..ae1bc80 --- /dev/null +++ b/ActiveRagdoll/Assets/TABG/Scripts/Camera/RotationTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d6017d73a8e55c946960548b77bb264b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |