map done
This commit is contained in:
89
Assets/Scripts/Character/scr_Models.cs
Normal file
89
Assets/Scripts/Character/scr_Models.cs
Normal file
@ -0,0 +1,89 @@
|
||||
// using System;
|
||||
// using UnityEngine;
|
||||
|
||||
// public static class scr_Models
|
||||
// {
|
||||
// #region Player
|
||||
|
||||
// public enum PlayerStance
|
||||
// {
|
||||
// Stand,
|
||||
// Crouch,
|
||||
// Prone
|
||||
// }
|
||||
|
||||
// [Serializable]
|
||||
// public class PlayerSettingsModel
|
||||
// {
|
||||
// [Header("View Settings")]
|
||||
// public float ViewXSensetivity;
|
||||
// public float ViewYSensetivity;
|
||||
|
||||
// public bool ViewXInverted;
|
||||
// public bool ViewYInverted;
|
||||
|
||||
// [Header("Movement Settings")]
|
||||
// public bool SprintingHold;
|
||||
// public float MovementSmoothing;
|
||||
|
||||
// [Header("Movement - Running")]
|
||||
// public float RunningForwardSpeed;
|
||||
// public float RunningStrafeSpeed;
|
||||
|
||||
// [Header("Movement - Walking")]
|
||||
// public float WalkingForwardSpeed;
|
||||
// public float WalkingBackwardSpeed;
|
||||
// public float WalkingStrafeSpeed;
|
||||
|
||||
// [Header("Jumping")]
|
||||
// public float JumpingHeight;
|
||||
// public float JumpingFalloff;
|
||||
// public float FallingSmoothing;
|
||||
// }
|
||||
|
||||
// [Serializable]
|
||||
// public class WeaponSettingsModel
|
||||
// {
|
||||
// [Header("Weapon Sway")]
|
||||
// public float SwayAmount;
|
||||
// public bool SwayYInverted;
|
||||
// public bool SwayXInverted;
|
||||
// public float SwaySmoothing;
|
||||
// public float SwayResetSmoothing;
|
||||
// public float SwayClampX;
|
||||
// public float SwayClampY;
|
||||
|
||||
// [Header("Weapon Movement Sway")]
|
||||
// public float MovementSwayX;
|
||||
// public float MovementSwayY;
|
||||
// public bool MovementSwayYInverted;
|
||||
// public bool MovementSwayXInverted;
|
||||
// public float MovementSwaySmoothing;
|
||||
// }
|
||||
|
||||
// [Serializable]
|
||||
// public class CharacterStance
|
||||
// {
|
||||
// public float CameraHeight;
|
||||
// public CapsuleCollider StanceCollider;
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region - Weapons -
|
||||
|
||||
// [Serializable]
|
||||
// public class WeaponSettingsModel
|
||||
// {
|
||||
// [Header("Sway")]
|
||||
// public float SwayAmount;
|
||||
// public bool SwayYInverted;
|
||||
// public bool SwayXInverted;
|
||||
// public float SwaySmoothing;
|
||||
// public float SwayResetSmoothing;
|
||||
// public float SwayClampX;
|
||||
// public float SwayClampY;
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
// }
|
11
Assets/Scripts/Character/scr_Models.cs.meta
generated
Normal file
11
Assets/Scripts/Character/scr_Models.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f67163350bd014f40a277862f1a675af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,81 +1,81 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using static scr_Models;
|
||||
// using System;
|
||||
// using UnityEditor;
|
||||
// using UnityEngine;
|
||||
// using UnityEngine.InputSystem;
|
||||
// using static scr_Models;
|
||||
|
||||
public class scr_FullCharacterController : MonoBehaviour
|
||||
{
|
||||
private scr_CharacterController characterController;
|
||||
[Header("Settings")]
|
||||
public WeaponSettingsModel settings;
|
||||
// public class scr_FullCharacterController : MonoBehaviour
|
||||
// {
|
||||
// private scr_CharacterController characterController;
|
||||
// [Header("Settings")]
|
||||
// public WeaponSettingsModel settings;
|
||||
|
||||
[Header("References")]
|
||||
public Animator SciFiWarriorOur;
|
||||
// [Header("References")]
|
||||
// public Animator SciFiWarriorOur;
|
||||
|
||||
private bool isInitialised;
|
||||
// private bool isInitialised;
|
||||
|
||||
Vector3 newWeaponRotation;
|
||||
Vector3 newWeaponRotationVelocity;
|
||||
// Vector3 newWeaponRotation;
|
||||
// Vector3 newWeaponRotationVelocity;
|
||||
|
||||
Vector3 targetWeaponRotation;
|
||||
Vector3 targetWeaponRotationVelocity;
|
||||
// Vector3 targetWeaponRotation;
|
||||
// Vector3 targetWeaponRotationVelocity;
|
||||
|
||||
Vector3 newWeaponMovementRotation;
|
||||
Vector3 newWeaponRotationMovementVelocity;
|
||||
// Vector3 newWeaponMovementRotation;
|
||||
// Vector3 newWeaponRotationMovementVelocity;
|
||||
|
||||
Vector3 targetWeaponMovementRotation;
|
||||
Vector3 targetWeaponMovementRotationVelocity;
|
||||
private void Start()
|
||||
{
|
||||
newWeaponRotation = transform.localRotation.eulerAngles;
|
||||
}
|
||||
// Vector3 targetWeaponMovementRotation;
|
||||
// Vector3 targetWeaponMovementRotationVelocity;
|
||||
// private void Start()
|
||||
// {
|
||||
// newWeaponRotation = transform.localRotation.eulerAngles;
|
||||
// }
|
||||
|
||||
public void Initialise(scr_CharacterController CharacterController)
|
||||
{
|
||||
characterController = CharacterController;
|
||||
isInitialised = true;
|
||||
}
|
||||
// public void Initialise(scr_CharacterController CharacterController)
|
||||
// {
|
||||
// characterController = CharacterController;
|
||||
// isInitialised = true;
|
||||
// }
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!isInitialised)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// public void Update()
|
||||
// {
|
||||
// if (!isInitialised)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
CalculateWeaponRotation();
|
||||
SetWeaponAnimation();
|
||||
}
|
||||
private void CalculateWeaponRotation()
|
||||
{
|
||||
SciFiWarriorOur.speed = characterController.weaponAnimationSpeed;
|
||||
// CalculateWeaponRotation();
|
||||
// SetWeaponAnimation();
|
||||
// }
|
||||
// private void CalculateWeaponRotation()
|
||||
// {
|
||||
// SciFiWarriorOur.speed = characterController.weaponAnimationSpeed;
|
||||
|
||||
targetWeaponRotation.y += settings.SwayAmount * (settings.SwayXInverted ? -characterController.input_View.x : characterController.input_View.x) * Time.deltaTime;
|
||||
targetWeaponRotation.x += settings.SwayAmount * (settings.SwayYInverted ? characterController.input_View.y : -characterController.input_View.y) * Time.deltaTime;
|
||||
//newWeaponRotation.x = Mathf.Clamp(newWeaponRotation.x, ViewClampYMin, ViewClampYMax);
|
||||
// targetWeaponRotation.y += settings.SwayAmount * (settings.SwayXInverted ? -characterController.input_View.x : characterController.input_View.x) * Time.deltaTime;
|
||||
// targetWeaponRotation.x += settings.SwayAmount * (settings.SwayYInverted ? characterController.input_View.y : -characterController.input_View.y) * Time.deltaTime;
|
||||
// //newWeaponRotation.x = Mathf.Clamp(newWeaponRotation.x, ViewClampYMin, ViewClampYMax);
|
||||
|
||||
targetWeaponRotation.x = Mathf.Clamp(targetWeaponRotation.x, -settings.SwayClampX, settings.SwayClampX);
|
||||
targetWeaponRotation.y = Mathf.Clamp(targetWeaponRotation.y, -settings.SwayClampY, settings.SwayClampY);
|
||||
// targetWeaponRotation.x = Mathf.Clamp(targetWeaponRotation.x, -settings.SwayClampX, settings.SwayClampX);
|
||||
// targetWeaponRotation.y = Mathf.Clamp(targetWeaponRotation.y, -settings.SwayClampY, settings.SwayClampY);
|
||||
|
||||
targetWeaponRotation.z = targetWeaponRotation.y;
|
||||
// targetWeaponRotation.z = targetWeaponRotation.y;
|
||||
|
||||
targetWeaponRotation = Vector3.SmoothDamp(targetWeaponRotation, Vector3.zero, ref targetWeaponRotationVelocity, settings.SwayResetSmoothing);
|
||||
newWeaponRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
|
||||
// targetWeaponRotation = Vector3.SmoothDamp(targetWeaponRotation, Vector3.zero, ref targetWeaponRotationVelocity, settings.SwayResetSmoothing);
|
||||
// newWeaponRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
|
||||
|
||||
targetWeaponMovementRotation.z = settings.MovementSwayX * (settings.MovementSwayXInverted ? -characterController.input_Movement.x : characterController.input_Movement.x);
|
||||
targetWeaponMovementRotation.x = settings.MovementSwayY * (settings.MovementSwayYInverted ? -characterController.input_Movement.y : characterController.input_Movement.y);
|
||||
// targetWeaponMovementRotation.z = settings.MovementSwayX * (settings.MovementSwayXInverted ? -characterController.input_Movement.x : characterController.input_Movement.x);
|
||||
// targetWeaponMovementRotation.x = settings.MovementSwayY * (settings.MovementSwayYInverted ? -characterController.input_Movement.y : characterController.input_Movement.y);
|
||||
|
||||
targetWeaponMovementRotation = Vector3.SmoothDamp(targetWeaponMovementRotation, Vector3.zero, ref targetWeaponMovementRotationVelocity, settings.SwayResetSmoothing);
|
||||
newWeaponMovementRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponMovementRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
|
||||
// targetWeaponMovementRotation = Vector3.SmoothDamp(targetWeaponMovementRotation, Vector3.zero, ref targetWeaponMovementRotationVelocity, settings.SwayResetSmoothing);
|
||||
// newWeaponMovementRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponMovementRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
|
||||
|
||||
|
||||
transform.localRotation = Quaternion.Euler(newWeaponRotation);
|
||||
}
|
||||
// transform.localRotation = Quaternion.Euler(newWeaponRotation);
|
||||
// }
|
||||
|
||||
private void SetWeaponAnimation()
|
||||
{
|
||||
SciFiWarriorOur.SetBool("isSprinting", characterController.isSprinting);
|
||||
SciFiWarriorOur.SetBool("isWalking", characterController.isWalking);
|
||||
}
|
||||
}
|
||||
// private void SetWeaponAnimation()
|
||||
// {
|
||||
// SciFiWarriorOur.SetBool("isSprinting", characterController.isSprinting);
|
||||
// SciFiWarriorOur.SetBool("isWalking", characterController.isWalking);
|
||||
// }
|
||||
// }
|
||||
|
Reference in New Issue
Block a user