Added Animations. Changed inspector view for navpoints. A lot of fixes. Changed project structure.

This commit is contained in:
2022-05-09 21:31:21 +07:00
parent 6aa872c92f
commit d617ddabe7
166 changed files with 28460 additions and 2197 deletions

3
Assets/Scripts/Animators.meta generated Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0cf97b021cee45eb8f7d402f16955139
timeCreated: 1652022637

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 97bb456bbc4248378002eefeb52be6c3
timeCreated: 1652022665

View File

@ -1,255 +1,253 @@
using UnityEngine;
using static scr_Models;
public class scr_CharacterController : MonoBehaviour
{
private CharacterController characterController;
private DefaultInput defaultInput;
private Vector2 input_Movement;
[HideInInspector]
public Vector2 input_View;
private Vector3 newCameraRotation;
private Vector3 newCharacterRotation;
[Header("References")]
public Transform cameraHolder;
public Transform feetTransform;
[Header("Settings")]
public PlayerSettingsModel playerSettings;
public float ViewClampYMin = -70;
public float ViewClampYMax = 80;
public LayerMask playerMask;
[Header("Gravity")]
public float gravityAmount;
public float gravityMin;
private float playerGravity;
public Vector3 jumpingForce;
private Vector3 jumpingForceVelocity;
[Header("Stance")]
public PlayerStance playerStance;
public float playerStanceSmoothing;
public CharacterStance playerStandStance;
public CharacterStance playerCrouchStance;
public CharacterStance playerProneStance;
private float stanceCheckErrorMargin = 0.05f;
private float cameraHeight;
private float cameraHeightVelocity;
private bool isSprinting;
private Vector3 newMovementSpeed;
private Vector3 newMovementSpeedVelocity;
[Header("Weapon")] public scr_WeaponController currentWeapon;
private void Awake()
{
defaultInput = new DefaultInput();
defaultInput.Character.Movement.performed += e => input_Movement = e.ReadValue<Vector2>();
defaultInput.Character.View.performed += e => input_View = e.ReadValue<Vector2>();
defaultInput.Character.Jump.performed += e => Jump();
defaultInput.Character.Crouch.performed += e => Crouch();
defaultInput.Character.Prone.performed += e => Prone();
defaultInput.Character.Sprint.performed += e => ToggleSprint();
defaultInput.Character.SprintReleased.performed += e => StopSprint();
defaultInput.Enable();
newCameraRotation = cameraHolder.localRotation.eulerAngles;
newCharacterRotation = transform.localRotation.eulerAngles;
characterController = GetComponent<CharacterController>();
cameraHeight = cameraHolder.localPosition.y;
if (currentWeapon)
{
currentWeapon.Initialise(this);
}
}
private void Update()
{
CalculateView();
CalculateMovement();
CalculateJump();
CalculateCameraHeight();
}
private void CalculateView()
{
newCharacterRotation.y += playerSettings.ViewXSensetivity * (playerSettings.ViewXInverted ? -input_View.x : input_View.x) * Time.deltaTime;
transform.localRotation = Quaternion.Euler(newCharacterRotation);
newCameraRotation.x += playerSettings.ViewYSensetivity * (playerSettings.ViewYInverted ? input_View.y : -input_View.y) * Time.deltaTime;
newCameraRotation.x = Mathf.Clamp(newCameraRotation.x, ViewClampYMin, ViewClampYMax);
cameraHolder.localRotation = Quaternion.Euler(newCameraRotation);
}
private void CalculateMovement()
{
if (input_Movement.y <= 0.2f)
{
isSprinting = false;
}
var verticalSpeed = playerSettings.WalkingForwardSpeed;
var horizontalSpeed = playerSettings.WalkingStrafeSpeed;
if (isSprinting)
{
verticalSpeed = playerSettings.RunningForwardSpeed;
horizontalSpeed = playerSettings.RunningStrafeSpeed;
}
// Effectors
if (!characterController.isGrounded)
{
playerSettings.SpeedEffector = playerSettings.FallingSpeedEffector;
}
else if (playerStance == PlayerStance.Crouch)
{
playerSettings.SpeedEffector = playerSettings.CrouchSpeedEffector;
}
else if (playerStance == PlayerStance.Prone)
{
playerSettings.SpeedEffector = playerSettings.ProneSpeedEffector;
}
else
{
playerSettings.SpeedEffector = 1;
}
verticalSpeed *= playerSettings.SpeedEffector;
horizontalSpeed *= playerSettings.SpeedEffector;
newMovementSpeed = Vector3.SmoothDamp(newMovementSpeed,
new Vector3(horizontalSpeed * input_Movement.x * Time.deltaTime,
0, verticalSpeed * input_Movement.y * Time.deltaTime),
ref newMovementSpeedVelocity, characterController.isGrounded ? playerSettings.MovementSmoothing : playerSettings.FallingSmoothing);
var MovementSpeed = transform.TransformDirection(newMovementSpeed);
if (playerGravity > gravityMin)
{
playerGravity -= gravityAmount * Time.deltaTime;
}
if (playerGravity < -0.1f && characterController.isGrounded)
{
playerGravity = -0.1f;
}
MovementSpeed.y += playerGravity;
MovementSpeed += jumpingForce * Time.deltaTime;
characterController.Move(MovementSpeed);
}
private void CalculateJump()
{
jumpingForce = Vector3.SmoothDamp(jumpingForce, Vector3.zero, ref jumpingForceVelocity, playerSettings.JumpingFalloff);
}
private void CalculateCameraHeight()
{
var stanceHeight = playerStandStance.CameraHeight;
if (playerStance == PlayerStance.Crouch)
{
stanceHeight = playerCrouchStance.CameraHeight;
}
else if (playerStance == PlayerStance.Prone)
{
stanceHeight = playerProneStance.CameraHeight;
}
cameraHeight = Mathf.SmoothDamp(cameraHolder.localPosition.y, stanceHeight, ref cameraHeightVelocity, playerStanceSmoothing);
cameraHolder.localPosition = new Vector3(cameraHolder.localPosition.x, cameraHeight, cameraHolder.localPosition.z);
}
private void Jump()
{
if (!characterController.isGrounded || playerStance == PlayerStance.Prone)
{
return;
}
if (playerStance == PlayerStance.Crouch)
{
if (StanceCheck(playerStandStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Stand;
return;
}
// Jump
jumpingForce = Vector3.up * playerSettings.JumpingHeight;
playerGravity = 0;
}
private void Crouch()
{
if (playerStance == PlayerStance.Crouch)
{
if (StanceCheck(playerStandStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Stand;
return;
}
if (StanceCheck(playerCrouchStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Crouch;
}
private void Prone()
{
playerStance = PlayerStance.Prone;
}
private bool StanceCheck(float stanceCheckheight)
{
var start = new Vector3(feetTransform.position.x, feetTransform.position.y + characterController.radius + stanceCheckErrorMargin, feetTransform.position.z);
var end = new Vector3(feetTransform.position.x, feetTransform.position.y - characterController.radius - stanceCheckErrorMargin + stanceCheckheight, feetTransform.position.z);
return Physics.CheckCapsule(start, end, characterController.radius, playerMask);
}
private void ToggleSprint()
{
if (input_Movement.y <= 0.2f)
{
isSprinting = false;
return;
}
isSprinting = !isSprinting;
}
private void StopSprint()
{
if (playerSettings.SprintingHold)
{
isSprinting = false;
}
}
}
using UnityEngine;
public class scr_CharacterController : MonoBehaviour
{
private CharacterController characterController;
private DefaultInput defaultInput;
private Vector2 input_Movement;
[HideInInspector]
public Vector2 input_View;
private Vector3 newCameraRotation;
private Vector3 newCharacterRotation;
[Header("References")]
public Transform cameraHolder;
public Transform feetTransform;
[Header("Settings")]
public PlayerSettingsModel playerSettings;
public float ViewClampYMin = -70;
public float ViewClampYMax = 80;
public LayerMask playerMask;
[Header("Gravity")]
public float gravityAmount;
public float gravityMin;
private float playerGravity;
public Vector3 jumpingForce;
private Vector3 jumpingForceVelocity;
[Header("Stance")]
public PlayerStance playerStance;
public float playerStanceSmoothing;
public CharacterStance playerStandStance;
public CharacterStance playerCrouchStance;
public CharacterStance playerProneStance;
private float stanceCheckErrorMargin = 0.05f;
private float cameraHeight;
private float cameraHeightVelocity;
private bool isSprinting;
private Vector3 newMovementSpeed;
private Vector3 newMovementSpeedVelocity;
[Header("Weapon")]
public scr_WeaponController currentWeapon;
private void Awake()
{
defaultInput = new DefaultInput();
defaultInput.Character.Movement.performed += e => input_Movement = e.ReadValue<Vector2>();
defaultInput.Character.View.performed += e => input_View = e.ReadValue<Vector2>();
defaultInput.Character.Jump.performed += e => Jump();
defaultInput.Character.Crouch.performed += e => Crouch();
defaultInput.Character.Prone.performed += e => Prone();
defaultInput.Character.Sprint.performed += e => ToggleSprint();
defaultInput.Character.SprintReleased.performed += e => StopSprint();
defaultInput.Enable();
newCameraRotation = cameraHolder.localRotation.eulerAngles;
newCharacterRotation = transform.localRotation.eulerAngles;
characterController = GetComponent<CharacterController>();
cameraHeight = cameraHolder.localPosition.y;
if (currentWeapon)
{
currentWeapon.Initialise(this);
}
}
private void Update()
{
CalculateView();
CalculateMovement();
CalculateJump();
CalculateCameraHeight();
}
private void CalculateView()
{
newCharacterRotation.y += playerSettings.ViewXSensetivity * (playerSettings.ViewXInverted ? -input_View.x : input_View.x) * Time.deltaTime;
transform.localRotation = Quaternion.Euler(newCharacterRotation);
newCameraRotation.x += playerSettings.ViewYSensetivity * (playerSettings.ViewYInverted ? input_View.y : -input_View.y) * Time.deltaTime;
newCameraRotation.x = Mathf.Clamp(newCameraRotation.x, ViewClampYMin, ViewClampYMax);
cameraHolder.localRotation = Quaternion.Euler(newCameraRotation);
}
private void CalculateMovement()
{
if (input_Movement.y <= 0.2f)
{
isSprinting = false;
}
var verticalSpeed = playerSettings.WalkingForwardSpeed;
var horizontalSpeed = playerSettings.WalkingStrafeSpeed;
if (isSprinting)
{
verticalSpeed = playerSettings.RunningForwardSpeed;
horizontalSpeed = playerSettings.RunningStrafeSpeed;
}
// Effectors
if (!characterController.isGrounded)
{
playerSettings.SpeedEffector = playerSettings.FallingSpeedEffector;
}
else if (playerStance == PlayerStance.Crouch)
{
playerSettings.SpeedEffector = playerSettings.CrouchSpeedEffector;
}
else if (playerStance == PlayerStance.Prone)
{
playerSettings.SpeedEffector = playerSettings.ProneSpeedEffector;
}
else
{
playerSettings.SpeedEffector = 1;
}
verticalSpeed *= playerSettings.SpeedEffector;
horizontalSpeed *= playerSettings.SpeedEffector;
newMovementSpeed = Vector3.SmoothDamp(newMovementSpeed,
new Vector3(horizontalSpeed * input_Movement.x * Time.deltaTime,
0, verticalSpeed * input_Movement.y * Time.deltaTime),
ref newMovementSpeedVelocity, characterController.isGrounded ? playerSettings.MovementSmoothing : playerSettings.FallingSmoothing);
var MovementSpeed = transform.TransformDirection(newMovementSpeed);
if (playerGravity > gravityMin)
{
playerGravity -= gravityAmount * Time.deltaTime;
}
if (playerGravity < -0.1f && characterController.isGrounded)
{
playerGravity = -0.1f;
}
MovementSpeed.y += playerGravity;
MovementSpeed += jumpingForce * Time.deltaTime;
characterController.Move(MovementSpeed);
}
private void CalculateJump()
{
jumpingForce = Vector3.SmoothDamp(jumpingForce, Vector3.zero, ref jumpingForceVelocity, playerSettings.JumpingFalloff);
}
private void CalculateCameraHeight()
{
var stanceHeight = playerStandStance.CameraHeight;
if (playerStance == PlayerStance.Crouch)
{
stanceHeight = playerCrouchStance.CameraHeight;
}
else if (playerStance == PlayerStance.Prone)
{
stanceHeight = playerProneStance.CameraHeight;
}
cameraHeight = Mathf.SmoothDamp(cameraHolder.localPosition.y, stanceHeight, ref cameraHeightVelocity, playerStanceSmoothing);
cameraHolder.localPosition = new Vector3(cameraHolder.localPosition.x, cameraHeight, cameraHolder.localPosition.z);
}
private void Jump()
{
if (!characterController.isGrounded || playerStance == PlayerStance.Prone)
{
return;
}
if (playerStance == PlayerStance.Crouch)
{
if (StanceCheck(playerStandStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Stand;
return;
}
// Jump
jumpingForce = Vector3.up * playerSettings.JumpingHeight;
playerGravity = 0;
}
private void Crouch()
{
if (playerStance == PlayerStance.Crouch)
{
if (StanceCheck(playerStandStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Stand;
return;
}
if (StanceCheck(playerCrouchStance.StanceCollider.height))
{
return;
}
playerStance = PlayerStance.Crouch;
}
private void Prone()
{
playerStance = PlayerStance.Prone;
}
private bool StanceCheck(float stanceCheckheight)
{
var start = new Vector3(feetTransform.position.x, feetTransform.position.y + characterController.radius + stanceCheckErrorMargin, feetTransform.position.z);
var end = new Vector3(feetTransform.position.x, feetTransform.position.y - characterController.radius - stanceCheckErrorMargin + stanceCheckheight, feetTransform.position.z);
return Physics.CheckCapsule(start, end, characterController.radius, playerMask);
}
private void ToggleSprint()
{
if (input_Movement.y <= 0.2f)
{
isSprinting = false;
return;
}
isSprinting = !isSprinting;
}
private void StopSprint()
{
if (playerSettings.SprintingHold)
{
isSprinting = false;
}
}
}

View File

@ -0,0 +1,67 @@
using System;
using UnityEngine;
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;
[Header("Speed Effectors")]
public float SpeedEffector = 1;
public float CrouchSpeedEffector;
public float ProneSpeedEffector;
public float FallingSpeedEffector;
}
[Serializable]
public class CharacterStance
{
public float CameraHeight;
public CapsuleCollider StanceCollider;
}
[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;
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2cc90c830ef641a1a18e8e21dc97dec0
timeCreated: 1652022681

View File

@ -0,0 +1,94 @@
using Unity.Mathematics;
using UnityEngine;
namespace Animators.Leonid_Animator
{
public class AnimatorHandler : MonoBehaviour
{
public Animator anim;
public bool canRotate;
private int _horizontal;
private int _vertical;
private bool _isCrouching = false;
private bool _isJumping;
private int _crouch;
private int _jump;
private int _fired;
public void Initialize()
{
anim = GetComponent<Animator>();
_vertical = Animator.StringToHash(nameof(_vertical));
_horizontal = Animator.StringToHash(nameof(_horizontal));
_crouch = Animator.StringToHash(nameof(_crouch));
_jump = Animator.StringToHash(nameof(_jump));
_fired = Animator.StringToHash(nameof(_fired));
}
public void UpdateAnimatorValues(float verticalMovement, float horizontalMovement,
bool pressedJumped, bool pressedCrouching, bool firePressed)
{
#region Vertical Movement
var vertical = 0f;
if (verticalMovement > 0 && verticalMovement < 0.55)
vertical = 0.5f;
else if (verticalMovement > 0.55)
vertical = 1;
else if (verticalMovement < 0 && verticalMovement > -0.55)
{
vertical = -0.5f;
}
else if (verticalMovement < -0.55)
{
vertical = -1;
}
else
{
vertical = 0;
}
#endregion
#region Vertical Movement
var horizontal = 0f;
if (horizontalMovement > 0 && horizontalMovement < 0.55)
horizontal = 0.5f;
else if (horizontalMovement > 0.55)
horizontal = 1;
else if (horizontalMovement < 0 && horizontalMovement > -0.55)
{
horizontal = -0.5f;
}
else if (horizontalMovement < -0.55)
{
horizontal = -1;
}
else
{
horizontal = 0;
}
#endregion
anim.SetFloat(_horizontal, horizontal, 0.1f, Time.deltaTime);
anim.SetFloat(_vertical, vertical, 0.1f, Time.deltaTime);
if (pressedCrouching == true)
{
_isCrouching = !_isCrouching;
if (_isCrouching == true)
transform.Rotate(Vector3.up, 45);
else
{
transform.Rotate(Vector3.up, -45);
}
anim.SetBool(_crouch, _isCrouching);
}
anim.SetBool(_jump, pressedJumped);
anim.SetBool(_fired, firePressed);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f9c5f555eb7641518e39a97abe893cd8
timeCreated: 1652031215

View File

@ -0,0 +1,905 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-8614502741554326989
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5023192667791512651}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.46723264
m_TransitionOffset: 0.21265899
m_ExitTime: 0.57224524
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-8265500127550764659
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Upper
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -4600760231423422918}
m_Position: {x: 340, y: 140, z: 0}
- serializedVersion: 1
m_State: {fileID: 7739110899394721029}
m_Position: {x: 510, y: -10, z: 0}
- serializedVersion: 1
m_State: {fileID: -4187437994059944167}
m_Position: {x: 400, y: 290, z: 0}
- serializedVersion: 1
m_State: {fileID: -5023192667791512651}
m_Position: {x: 830, y: 130, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 1150, y: 160, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -4600760231423422918}
--- !u!1101 &-6757359955429936644
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump to Run
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8354844821256608690}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.20300466
m_TransitionOffset: 0
m_ExitTime: 0.7916667
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-6673604382440492192
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _fired
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4187437994059944167}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 1.2815269
m_TransitionOffset: 0.04597427
m_ExitTime: 0.009130422
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-5914497066343941395
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 5168308916736617153}
- {fileID: 9141976730198879995}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: c09541f4236345c4fa4e4745793a59f3, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-5341886129914063569
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _jump
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4600760231423422918}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.7916667
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-5023192667791512651
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Die
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 1131199853383832992}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: d406f8f3cbe268f4e9d0234d45cca60c, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-4911913766117122026
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 0}
m_Solo: 0
m_Mute: 0
m_IsExit: 1
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.765625
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-4865886577319040672
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Run to Jump
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _jump
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5914497066343941395}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-4600760231423422918
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Idle
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -632880110147916710}
- {fileID: -6673604382440492192}
- {fileID: -70235823626180740}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 107649059ea401b4e9c5c20f21e99a55, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-4187437994059944167
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Fire
m_Speed: 10
m_CycleOffset: 0
m_Transitions:
- {fileID: -146642472328627549}
- {fileID: -8614502741554326989}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 1d4365e1541bb6949a273318862b72d3, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-4114131529631250501
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5023192667791512651}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.7343743
m_TransitionOffset: 0.08256394
m_ExitTime: 0.28710982
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-3812287898245291883
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump to Run
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8354844821256608690}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.20300466
m_TransitionOffset: 0
m_ExitTime: 0.7916667
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-3071590976036615157
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 381506674367370628}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0.542241
m_ExitTime: 0.75
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-2302487397917704150
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lower
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 8354844821256608690}
m_Position: {x: 460, y: 60, z: 0}
- serializedVersion: 1
m_State: {fileID: -5914497066343941395}
m_Position: {x: 580, y: -120, z: 0}
- serializedVersion: 1
m_State: {fileID: -1946935121236979824}
m_Position: {x: 490, y: 230, z: 0}
- serializedVersion: 1
m_State: {fileID: 381506674367370628}
m_Position: {x: 980, y: 60, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 1130, y: 240, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 8354844821256608690}
--- !u!1102 &-1946935121236979824
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Crouch
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 5680347307725438578}
- {fileID: -3071590976036615157}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 3ad7c5979f6586d4a9532a55492a0ebe, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter: _jump
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!206 &-1862914767576164720
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 107649059ea401b4e9c5c20f21e99a55, type: 3}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: horizontal
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 043a0882d93547c4da0104443de76efb, type: 3}
m_Threshold: 1
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: horizontal
m_Mirror: 0
m_BlendParameter: _vertical
m_BlendParameterY: _horizontal
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 3
--- !u!1101 &-632880110147916710
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _jump
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 7739110899394721029}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.8125
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-146642472328627549
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _fired
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4600760231423422918}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.8125
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-70235823626180740
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5023192667791512651}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.982062
m_TransitionOffset: 0.000000027939697
m_ExitTime: 0.26345384
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CharacterAnimator
serializedVersion: 5
m_AnimatorParameters:
- m_Name: _horizontal
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: _vertical
m_Type: 1
m_DefaultFloat: 1
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: _jump
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: _crouch
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: _died
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: _fired
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Lower
m_StateMachine: {fileID: -2302487397917704150}
m_Mask: {fileID: 31900000, guid: 1122aed799ca7574a8f0d2efa30e9d99, type: 2}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
- serializedVersion: 5
m_Name: Upper
m_StateMachine: {fileID: -8265500127550764659}
m_Mask: {fileID: 31900000, guid: 368b178fc56a14549b588ee80c7cbf81, type: 2}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 1
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &381506674367370628
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Die
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -4911913766117122026}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: d406f8f3cbe268f4e9d0234d45cca60c, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &1131199853383832992
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 0}
m_Solo: 0
m_Mute: 0
m_IsExit: 1
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.765625
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1426403871767708545
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 0}
m_Solo: 0
m_Mute: 0
m_IsExit: 1
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.765625
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1766918516916494365
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _crouch
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -1946935121236979824}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &2942481661802285141
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 381506674367370628}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.45466095
m_TransitionOffset: 0
m_ExitTime: 0.5480226
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &4669644873837644826
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 381506674367370628}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 1.0268358
m_TransitionOffset: 0.026483208
m_ExitTime: 0.22033934
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5168308916736617153
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump to Run
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8354844821256608690}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.20300466
m_TransitionOffset: 0
m_ExitTime: 0.7916667
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5680347307725438578
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: _crouch
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8354844821256608690}
m_Solo: 1
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.09322041
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &7161422939700495704
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 381506674367370628}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.45466095
m_TransitionOffset: 0
m_ExitTime: 0.5480226
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &7739110899394721029
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Jump
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -5341886129914063569}
- {fileID: -4114131529631250501}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: c09541f4236345c4fa4e4745793a59f3, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &8354844821256608690
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Locomotion
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -4865886577319040672}
- {fileID: 1766918516916494365}
- {fileID: 4669644873837644826}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -1862914767576164720}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &9141976730198879995
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: _died
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 381506674367370628}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.45466095
m_TransitionOffset: 0
m_ExitTime: 0.5480226
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ebf60422b6cb1c498ee4cf238072b43
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,105 @@
using UnityEngine;
namespace Animators.Leonid_Animator
{
[RequireComponent(
typeof(Rigidbody),
typeof(InputHandler),
typeof(AnimatorHandler))]
public class CharacterLocomotion : MonoBehaviour
{
private Transform _cameraObject;
private InputHandler _inputHandler;
private Vector3 _moveDirection;
[HideInInspector] public Transform myTransform;
[HideInInspector] public AnimatorHandler myAnimatorHandler;
public Rigidbody myRigidbody;
[SerializeField] public float jumpForce;
public GameObject normalCamera;
[Header("Stats")]
[SerializeField] private float movementSpeed = 5;
[SerializeField] private float rotationSpeed = 10;
private void Start()
{
myRigidbody = GetComponent<Rigidbody>();
_inputHandler = GetComponent<InputHandler>();
myAnimatorHandler = GetComponent<AnimatorHandler>();
_cameraObject = Camera.main.transform;
myTransform = transform;
myAnimatorHandler.Initialize();
}
private void Update()
{
var deltaTime = Time.deltaTime;
_inputHandler.TickInput(deltaTime);
_moveDirection = _cameraObject.forward * _inputHandler.vertical
+ _cameraObject.right * _inputHandler.horizontal;
_moveDirection.Normalize();
_moveDirection *= movementSpeed;
_moveDirection.y = 0;
var projectedVelocity = Vector3.ProjectOnPlane(_moveDirection, _normalVector);
myRigidbody.velocity = projectedVelocity;
if (myAnimatorHandler.canRotate)
{
HandleRotation(deltaTime);
}
myAnimatorHandler.UpdateAnimatorValues(
_inputHandler.moveAmount,
0,
_inputHandler.jumpPressed,
_inputHandler.crouchPressed,
_inputHandler.firePressed);
var velocity = myRigidbody.velocity;
myRigidbody.AddForce(_inputHandler.jumpPressed ?
new Vector3(0, jumpForce, 0)
: new Vector3(velocity.x*100, -50, velocity.z * 100));
}
private void LateUpdate()
{
_inputHandler.jumpPressed = false;
_inputHandler.crouchPressed = false;
}
#region Movement
private Vector3 _normalVector;
private Vector3 _targetPosition;
private void HandleRotation(float delta)
{
if (Mathf.Abs(_inputHandler.horizontal) + Mathf.Abs(_inputHandler.vertical) < 0.1)
{
print("stop");
return;
}
print("begin");
var moveAmount = _inputHandler.moveAmount;
var targetDir = _cameraObject.forward * _inputHandler.vertical
+ _cameraObject.right * _inputHandler.horizontal;
targetDir.Normalize();
targetDir.y = 0;
if (targetDir == Vector3.zero)
targetDir = myTransform.forward;
var rotSpeed = rotationSpeed;
var rotation = Quaternion.LookRotation(targetDir);
var targetRotation = Quaternion.Slerp(myTransform.rotation, rotation, rotationSpeed * delta);
myTransform.rotation = targetRotation;
}
#endregion
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aeafb7b8074141969e8779cd3d4a9d08
timeCreated: 1652026088

View File

@ -0,0 +1,77 @@
using CameraScripts;
using UnityEngine;
namespace Animators.Leonid_Animator
{
public class InputHandler : MonoBehaviour
{
public float horizontal;
public float vertical;
public float moveAmount;
public float mouseX;
public float mouseY;
public bool crouchPressed;
public bool jumpPressed;
public bool firePressed;
private ThirdPersonViewInput _inputActions;
private Vector2 _movementInput;
private Vector2 _cameraInput;
private CameraHandler _cameraHandler;
private void Awake()
{
_cameraHandler = CameraHandler.Singleton;
if (_cameraHandler == null)
Debug.LogError("Camera Handler not found");
}
private void Update()
{
_cameraHandler.TargetPosition(Time.deltaTime);
_cameraHandler.HandleCameraRotation(Time.deltaTime, mouseX, mouseY);
}
private void OnEnable()
{
if (_inputActions is null)
{
_inputActions = new ThirdPersonViewInput();
_inputActions.PlayerMovement.Movement.performed +=
context => _movementInput = context.ReadValue<Vector2>();
_inputActions.PlayerMovement.Camera.performed +=
context => _cameraInput = context.ReadValue<Vector2>();
_inputActions.PlayerActions.Crouch.performed +=
context => crouchPressed = true;
_inputActions.PlayerActions.Jump.performed +=
context => jumpPressed = true;
_inputActions.PlayerActions.Fire.performed +=
context => firePressed = true;
_inputActions.PlayerActions.Fire.canceled +=
context => firePressed = false;
}
_inputActions.Enable();
}
private void OnDisable()
{
_inputActions.Disable();
}
public void TickInput(float delta)
{
MoveInput(delta);
}
private void MoveInput(float delta)
{
horizontal = _movementInput.x;
vertical = _movementInput.y;
moveAmount = Mathf.Clamp01(Mathf.Abs(horizontal) + Mathf.Abs(vertical));
mouseX = _cameraInput.x;
mouseY = _cameraInput.y;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 77c38ddfaba349c590d4a6583f7efac4
timeCreated: 1652025145

View File

@ -0,0 +1,139 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!319 &31900000
AvatarMask:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LowerBody
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
m_Elements:
- m_Path:
m_Weight: 1
- m_Path: Arm1
m_Weight: 1
- m_Path: AssaultRifle
m_Weight: 1
- m_Path: Backpack1
m_Weight: 1
- m_Path: Body1
m_Weight: 1
- m_Path: head1
m_Weight: 1
- m_Path: Hips
m_Weight: 1
- m_Path: Hips/ArmPosition_Left
m_Weight: 1
- m_Path: Hips/ArmPosition_Right
m_Weight: 1
- m_Path: Hips/ArmPosition_Right/magazine_Right
m_Weight: 1
- m_Path: Hips/ArmPosition_Right/Trigger_Right
m_Weight: 1
- m_Path: Hips/Spine
m_Weight: 1
- m_Path: Hips/Spine/Chest
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Upper
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head/Headgear_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head/Headgear_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left/ShoulderPadBlade_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left/ShoulderPadBody_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left/Index_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left/Index_Intermediate_Left/Index_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left/RestOfFingers_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left/RestOfFingers_Intermediate_Left/RestOfFingers_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left/Thumb_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left/Thumb_Intermediate_Left/Thumb_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right/ShoulderPadBlade_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right/ShoulderPadBody_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right/Index_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right/Index_Intermediate_Right/Index_Distal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right/RestOfFingers_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right/RestOfFingers_Intermediate_Right/RestOfFingers_Distal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right/Thumb_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right/Thumb_Intermediate_Right/Thumb_Distal_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left/Toe_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left/Toe_Left/Toetip_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right/Toe_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right/Toe_Right/Toetip_Right
m_Weight: 1
- m_Path: Leg1
m_Weight: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1122aed799ca7574a8f0d2efa30e9d99
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 31900000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,139 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!319 &31900000
AvatarMask:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UpperBody
m_Mask: 00000000010000000100000000000000000000000100000001000000010000000100000000000000000000000000000000000000
m_Elements:
- m_Path:
m_Weight: 1
- m_Path: Arm1
m_Weight: 1
- m_Path: AssaultRifle
m_Weight: 1
- m_Path: Backpack1
m_Weight: 1
- m_Path: Body1
m_Weight: 1
- m_Path: head1
m_Weight: 1
- m_Path: Hips
m_Weight: 1
- m_Path: Hips/ArmPosition_Left
m_Weight: 1
- m_Path: Hips/ArmPosition_Right
m_Weight: 1
- m_Path: Hips/ArmPosition_Right/magazine_Right
m_Weight: 1
- m_Path: Hips/ArmPosition_Right/Trigger_Right
m_Weight: 1
- m_Path: Hips/Spine
m_Weight: 1
- m_Path: Hips/Spine/Chest
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/BackPack/ArmPlacement_Upper
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head/Headgear_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Neck/Head/Headgear_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left/ShoulderPadBlade_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/ShoulderPadCTRL_Left/ShoulderPadBody_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left/Index_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Index_Proximal_Left/Index_Intermediate_Left/Index_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left/RestOfFingers_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/RestOfFingers_Proximal_Left/RestOfFingers_Intermediate_Left/RestOfFingers_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left/Thumb_Intermediate_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Left/UpperArm_Left/LowerArm_Left/Hand_Left/Thumb_Proximal_Left/Thumb_Intermediate_Left/Thumb_Distal_Left
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right/ShoulderPadBlade_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/ShoulderPadCTRL_Right/ShoulderPadBody_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right/Index_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Index_Proximal_Right/Index_Intermediate_Right/Index_Distal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right/RestOfFingers_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/RestOfFingers_Proximal_Right/RestOfFingers_Intermediate_Right/RestOfFingers_Distal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right/Thumb_Intermediate_Right
m_Weight: 1
- m_Path: Hips/Spine/Chest/Shoulder_Right/UpperArm_Right/LowerArm_Right/Hand_Right/Thumb_Proximal_Right/Thumb_Intermediate_Right/Thumb_Distal_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left/Toe_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Left/LowerLeg_Left/Foot_Left/Toe_Left/Toetip_Left
m_Weight: 1
- m_Path: Hips/UpperLeg_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right/Toe_Right
m_Weight: 1
- m_Path: Hips/UpperLeg_Right/LowerLeg_Right/Foot_Right/Toe_Right/Toetip_Right
m_Weight: 1
- m_Path: Leg1
m_Weight: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 368b178fc56a14549b588ee80c7cbf81
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 31900000
userData:
assetBundleName:
assetBundleVariant:

3
Assets/Scripts/CameraScripts.meta generated Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 563fa8c0f982459e8a6357c9f9078744
timeCreated: 1652086279

View File

@ -0,0 +1,61 @@
using System;
using Unity.Mathematics;
using UnityEngine;
namespace CameraScripts
{
public class CameraHandler : MonoBehaviour
{
public Transform targetTransform;
public Transform cameraTransform;
public Transform cameraPivotTransform;
private Transform _myTransform;
private Vector3 _cameraTransformPosition;
private LayerMask ignoreLayers = ~(1 << 8 | 1 << 9 | 1 << 10);
public static CameraHandler Singleton;
public const float LookSpeed = 0.1f;
public const float FollowSpeed = 0.1f;
public const float PivotSpeed = 0.03f;
private float _defaultPosition;
private float _lookAngle;
private float _pivotAngle;
public float minimumPivot = -35;
public float maximumPivot = 35;
private void Awake()
{
Application.targetFrameRate = 60;
Singleton = this;
_myTransform = transform;
_defaultPosition = _myTransform.localPosition.z;
}
public void TargetPosition(float delta)
{
var toTargetPosition = Vector3.Lerp(_myTransform.position, targetTransform.position, delta /FollowSpeed);
_myTransform.position = toTargetPosition;
}
public void HandleCameraRotation(float delta, float mouseX, float mouseY)
{
_lookAngle += (mouseX * LookSpeed) / delta;
_pivotAngle -= (mouseY * PivotSpeed) / delta;
_pivotAngle = Mathf.Clamp(_pivotAngle, minimumPivot, maximumPivot);
var rotation = Vector3.zero;
rotation.y = _lookAngle;
var targetRotation = Quaternion.Euler(rotation);
_myTransform.rotation = targetRotation;
rotation = Vector3.zero;
rotation.x = _pivotAngle;
targetRotation = Quaternion.Euler(rotation);
cameraPivotTransform.localRotation = targetRotation;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3d606407023147d7b4d530a9593e9697
timeCreated: 1652086288

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

View File

@ -1,75 +0,0 @@
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;
[Header("Speed Effectors")]
public float SpeedEffector = 1;
public float CrouchSpeedEffector;
public float ProneSpeedEffector;
public float FallingSpeedEffector;
}
[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
}

View File

@ -14,12 +14,11 @@ public class NavPoint : MonoBehaviour
public Vector3 Position => gameObject.transform.position;
public float FlagDistance { get; private set; }
public NavPointType navType = NavPointType.Direction;
[SerializeField] public NavPointType navType;
[HideInInspector]
public int PointId = 0;
public float DeathAttr = 0;
public List<Vector3> EnemiesSeen = new List<Vector3>();
[HideInInspector] public int PointId = 0;
[HideInInspector] public float DeathAttr = 0;
[HideInInspector] public List<Vector3> EnemiesSeen = new List<Vector3>();
private void Start()
{

View File

@ -1,47 +1,46 @@
using UnityEngine;
using static scr_Models;
public class scr_WeaponController : MonoBehaviour
{
private scr_CharacterController characterController;
[Header("Settings")]
public WeaponSettingsModel settings;
private bool isInitialised;
Vector3 newWeaponRotation;
Vector3 newWeaponRotationVelocity;
Vector3 targetWeaponRotation;
Vector3 targetWeaponRotationVelocity;
private void Start()
{
newWeaponRotation = transform.localRotation.eulerAngles;
}
public void Initialise(scr_CharacterController CharacterController)
{
characterController = CharacterController;
isInitialised = true;
}
public void Update()
{
if (!isInitialised)
{
return;
}
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 = Vector3.SmoothDamp(targetWeaponRotation, Vector3.zero, ref targetWeaponRotationVelocity, settings.SwayResetSmoothing);
newWeaponRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
transform.localRotation = Quaternion.Euler(newWeaponRotation);
}
}
using UnityEngine;
public class scr_WeaponController : MonoBehaviour
{
private scr_CharacterController characterController;
[Header("Settings")]
public WeaponSettingsModel settings;
private bool isInitialised;
Vector3 newWeaponRotation;
Vector3 newWeaponRotationVelocity;
Vector3 targetWeaponRotation;
Vector3 targetWeaponRotationVelocity;
private void Start()
{
newWeaponRotation = transform.localRotation.eulerAngles;
}
public void Initialise(scr_CharacterController CharacterController)
{
characterController = CharacterController;
isInitialised = true;
}
public void Update()
{
if (!isInitialised)
{
return;
}
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 = Vector3.SmoothDamp(targetWeaponRotation, Vector3.zero, ref targetWeaponRotationVelocity, settings.SwayResetSmoothing);
newWeaponRotation = Vector3.SmoothDamp(newWeaponRotation, targetWeaponRotation, ref newWeaponRotationVelocity, settings.SwaySmoothing);
transform.localRotation = Quaternion.Euler(newWeaponRotation);
}
}