Ciro Continisio
4 年前
当前提交
72d7c142
共有 117 个文件被更改,包括 1334 次插入 和 972 次删除
-
858UOP1_Project/Assets/Scenes/StateMachines.unity
-
151UOP1_Project/Assets/Scripts/Characters/Character.cs
-
36UOP1_Project/Assets/Scripts/Characters/Protagonist.cs
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/RotateActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/ApplyMovementVectorActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/DescendActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/GroundGravityActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/HorizontalMoveActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/SlideActionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs.meta
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs.meta
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist.meta
-
8UOP1_Project/Assets/Scripts/Characters/StateMachine.meta
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/ApplyMovementVector.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/ApplyMovementVector.asset.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Ascend.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Ascend.asset.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Descend.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Descend.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/GroundGravity.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/GroundGravity.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/MoveInTheAir.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/MoveInTheAir.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Rotate.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Rotate.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/RotateFast.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/RotateFast.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Slide.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Slide.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/SlidingGravity.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/SlidingGravity.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Walk.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Actions/Walk.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/HasHitHead.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/HasHitHead.asset.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsGrounded.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsGrounded.asset.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsHoldingJump.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsHoldingJump.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsMoving.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsMoving.asset.meta
-
14UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsSliding.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/IsSliding.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/JumpHoldTimer.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Conditions/JumpHoldTimer.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States.meta
-
20UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Idle.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Idle.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Protagonist/States/JumpAscending.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States/JumpAscending.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Protagonist/States/JumpDescending.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States/JumpDescending.asset.meta
-
21UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Sliding.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Sliding.asset.meta
-
24UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Walking.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/States/Walking.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/BeginJump.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/BeginJump.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/BeginJumpDescent.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/BeginJumpDescent.asset.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/HitHead.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/HitHead.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/LandIdle.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/LandIdle.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/LandWalking.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/LandWalking.asset.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StartSliding.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StartSliding.asset.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StartWalking.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StartWalking.asset.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StopSliding.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StopSliding.asset.meta
-
19UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StopWalking.asset
-
8UOP1_Project/Assets/ScriptableObjects/Protagonist/Transitions/StopWalking.asset.meta
-
8UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions.meta
-
24UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/ApplyMovementVectorActionSO.cs
-
50UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs
-
42UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/DescendActionSO.cs
-
35UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/GroundGravityActionSO.cs
-
35UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/HorizontalMoveActionSO.cs
-
48UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/RotateActionSO.cs
-
42UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/SlideActionSO.cs
-
8UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions.meta
-
45UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs
-
18UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsCharacterControllerGroundedConditionSO.cs
-
11UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsCharacterControllerGroundedConditionSO.cs.meta
-
19UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsHoldingJumpConditionSO.cs
-
11UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsHoldingJumpConditionSO.cs.meta
-
39UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsMovingConditionSO.cs
|
|||
using UnityEngine; |
|||
using UnityEngine.PlayerLoop; |
|||
private CharacterController characterController; |
|||
|
|||
[Tooltip("Horizontal XZ plane speed multiplier")] public float speed = 8f; |
|||
[Tooltip("Smoothing for rotating the character to their movement direction")] public float turnSmoothTime = 0.2f; |
|||
[Tooltip("General multiplier for gravity (affects jump and freefall)")] public float gravityMultiplier = 5f; |
|||
[Tooltip("The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity")] public float initialJumpForce = 10f; |
|||
[Tooltip("How long can the player hold the jump button")] public float jumpInputDuration = .4f; |
|||
[Tooltip("Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster")] public float gravityComebackMultiplier = 15f; |
|||
[Tooltip("The maximum speed reached when falling (in units/frame)")] public float maxFallSpeed = 50f; |
|||
[Tooltip("Each frame while jumping, gravity will be multiplied by this amount in an attempt to 'cancel it' (= jump higher)")] public float gravityDivider = .6f; |
|||
[Tooltip("Adjust the friction of the slope")] public float slideFriction = 0.3f; |
|||
[Tooltip("Starting vertical movement when falling from a platform")] public float fallingVerticalMovement = -5f; |
|||
|
|||
|
|||
private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
|
|||
private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
|
|||
private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
|
|||
private float turnSmoothSpeed; //Used by Mathf.SmoothDampAngle to smoothly rotate the character to their movement direction
|
|||
private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
|
|||
private float currentSlope; |
|||
private Vector3 hitNormal; // ground normal
|
|||
private bool shouldSlide; // Should player slide?
|
|||
private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
|
|||
private Vector3 movementVector; //Final movement vector
|
|||
public bool jumpInput; |
|||
public Vector3 movementInput; //Initial input coming from the Protagonist script
|
|||
public Vector3 movementVector; //Final movement vector, manipulated by the StateMachine actions
|
|||
public ControllerColliderHit lastHit; |
|||
private const float ROTATION_TRESHOLD = .02f; // Used to prevent NaN result causing rotation in a non direction
|
|||
|
|||
private void Awake() |
|||
private void OnControllerColliderHit(ControllerColliderHit hit) |
|||
characterController = GetComponent<CharacterController>(); |
|||
lastHit = hit; |
|||
private void Update() |
|||
{ |
|||
//Raises the multiplier to how much gravity will affect vertical movement when in mid-air
|
|||
//This is 0f at the beginning of a jump and will raise to maximum 1f
|
|||
if (!characterController.isGrounded) |
|||
{ |
|||
gravityContributionMultiplier += Time.deltaTime * gravityComebackMultiplier; |
|||
} |
|||
//Reduce the influence of the gravity while holding the Jump button
|
|||
if (isJumping) |
|||
{ |
|||
//The player can only hold the Jump button for so long
|
|||
if (Time.time >= jumpBeginTime + jumpInputDuration) |
|||
{ |
|||
isJumping = false; |
|||
gravityContributionMultiplier = 1f; //Gravity influence is reset to full effect
|
|||
} |
|||
else |
|||
{ |
|||
gravityContributionMultiplier *= gravityDivider; //Reduce the gravity effect
|
|||
} |
|||
} |
|||
//Calculate the final verticalMovement
|
|||
if (!characterController.isGrounded) |
|||
{ |
|||
//Less control in mid-air, conserving momentum from previous frame
|
|||
movementVector = inputVector * speed; |
|||
//The character is either jumping or in freefall, so gravity will add up
|
|||
gravityContributionMultiplier = Mathf.Clamp01(gravityContributionMultiplier); |
|||
verticalMovement += Physics.gravity.y * gravityMultiplier * Time.deltaTime * gravityContributionMultiplier; //Add gravity contribution
|
|||
//Note that even if it's added, the above value is negative due to Physics.gravity.y
|
|||
//Cap the maximum so the player doesn't reach incredible speeds when freefalling from high positions
|
|||
verticalMovement = Mathf.Clamp(verticalMovement, -maxFallSpeed, 100f); |
|||
} |
|||
else |
|||
{ |
|||
//Full speed ground movement
|
|||
movementVector = inputVector * speed; |
|||
//Resets the verticalMovement while on the ground,
|
|||
//so that regardless of whether the player landed from a high fall or not,
|
|||
//if they drop off a platform they will always start with the same verticalMovement.
|
|||
//-5f is a good value to make it so the player also sticks to uneven terrain/bumps without floating
|
|||
if (!isJumping) |
|||
{ |
|||
verticalMovement = fallingVerticalMovement; |
|||
gravityContributionMultiplier = 0f; |
|||
} |
|||
} |
|||
UpdateSlide(); |
|||
//Apply the result and move the character in space
|
|||
movementVector.y = verticalMovement; |
|||
characterController.Move(movementVector * Time.deltaTime); |
|||
//Rotate to the movement direction
|
|||
movementVector.y = 0f; |
|||
if (movementVector.sqrMagnitude >= ROTATION_TRESHOLD) |
|||
{ |
|||
float targetRotation = Mathf.Atan2(movementVector.x, movementVector.z) * Mathf.Rad2Deg; |
|||
transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle( |
|||
transform.eulerAngles.y, |
|||
targetRotation, |
|||
ref turnSmoothSpeed, |
|||
turnSmoothTime); |
|||
} |
|||
} |
|||
|
|||
private void OnControllerColliderHit(ControllerColliderHit hit) |
|||
{ |
|||
hitNormal = hit.normal; |
|||
bool isMovingUpwards = verticalMovement > 0f; |
|||
if (isMovingUpwards) |
|||
{ |
|||
// Making sure the collision is near the top of the head
|
|||
float permittedDistance = characterController.radius / 2f; |
|||
float topPositionY = transform.position.y + characterController.height; |
|||
float distance = Mathf.Abs(hit.point.y - topPositionY); |
|||
if (distance <= permittedDistance) |
|||
{ |
|||
// Stopping any upwards movement
|
|||
// and having the player fall back down
|
|||
isJumping = false; |
|||
gravityContributionMultiplier = 1f; |
|||
verticalMovement = 0f; |
|||
} |
|||
} |
|||
} |
|||
inputVector = movement; |
|||
movementInput = movement; |
|||
// Disable jumping if player has to slide
|
|||
if (characterController.isGrounded && !shouldSlide) |
|||
{ |
|||
isJumping = true; |
|||
jumpBeginTime = Time.time; |
|||
verticalMovement = initialJumpForce; //This is the only place where verticalMovement is set to a positive value
|
|||
gravityContributionMultiplier = 0f; |
|||
} |
|||
jumpInput = true; |
|||
isJumping = false; //This will stop the reduction to the gravity, which will then quickly pull down the character
|
|||
} |
|||
|
|||
private void UpdateSlide() |
|||
{ |
|||
// if player has to slide then add sideways speed to make it go down
|
|||
if (shouldSlide) |
|||
{ |
|||
movementVector.x += (1f - hitNormal.y) * hitNormal.x * (speed - slideFriction); |
|||
movementVector.z += (1f - hitNormal.y) * hitNormal.z * (speed - slideFriction); |
|||
} |
|||
// check if the controller is grounded and above slope limit
|
|||
// if player is grounded and above slope limit
|
|||
// player has to slide
|
|||
if (characterController.isGrounded) |
|||
{ |
|||
currentSlope = Vector3.Angle(Vector3.up, hitNormal); |
|||
shouldSlide = currentSlope >= characterController.slopeLimit; |
|||
} |
|||
jumpInput = false; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d230f7c554e81b244bfed84bda39fb82 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ffc79fdf94115ec4aa7aa8eab84a4afc |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 8e60fd50527f7904794623b771901faf |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 816d77d35a7ae9041969e6fdee982452, type: 3} |
|||
m_Name: ApplyMovementVector |
|||
m_EditorClassIdentifier: Assembly-CSharp::ApplyMovementVectorSO |
|
|||
fileFormatVersion: 2 |
|||
guid: 47d9da417e68970419335f80f4395239 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: d102e2f241954884fba03c7553584369, type: 3} |
|||
m_Name: Ascend |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5d9c1bbe4ffcb2146a540998d17b665d |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: bc39053ee56f2cf40af8511f79013117, type: 3} |
|||
m_Name: Descend |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5d442cfcb78da8b418d6ae3e93e5748e |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 5e724f945a0fb204fa0f39919afe653b, type: 3} |
|||
m_Name: GroundGravity |
|||
m_EditorClassIdentifier: |
|||
_verticalPull: -5 |
|
|||
fileFormatVersion: 2 |
|||
guid: bd85c54d16eb60c4c99504f1679af851 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 09fcb347b6cb3524c9f59fbde36ec7c7, type: 3} |
|||
m_Name: MoveInTheAir |
|||
m_EditorClassIdentifier: |
|||
_speed: 6 |
|
|||
fileFormatVersion: 2 |
|||
guid: f1f9b67c2b957d74dae6555b3598ae49 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8c2b40ff7519a5e41a2dc48c2aca516c, type: 3} |
|||
m_Name: Rotate |
|||
m_EditorClassIdentifier: |
|||
_turnSmoothTime: 0.2 |
|
|||
fileFormatVersion: 2 |
|||
guid: 096d532f9a47f3145892efa1c4322e72 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8c2b40ff7519a5e41a2dc48c2aca516c, type: 3} |
|||
m_Name: RotateFast |
|||
m_EditorClassIdentifier: |
|||
_turnSmoothTime: 0.1 |
|
|||
fileFormatVersion: 2 |
|||
guid: 4badb7afa3370ba4d8a229584c5c744f |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 3d6639e9199e4ec44852fe925b2dc470, type: 3} |
|||
m_Name: Slide |
|||
m_EditorClassIdentifier: |
|||
_slideSpeed: 10 |
|
|||
fileFormatVersion: 2 |
|||
guid: 9e558dc250163db40a4e1f7241ee15c2 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 5e724f945a0fb204fa0f39919afe653b, type: 3} |
|||
m_Name: SlidingGravity |
|||
m_EditorClassIdentifier: |
|||
_verticalPull: -10 |
|
|||
fileFormatVersion: 2 |
|||
guid: 088f3e34793299349983d53aaf39e5e3 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 09fcb347b6cb3524c9f59fbde36ec7c7, type: 3} |
|||
m_Name: Walk |
|||
m_EditorClassIdentifier: |
|||
_speed: 8 |
|
|||
fileFormatVersion: 2 |
|||
guid: 6a9da1e686e8c3142bcbcc7ccb5bd5ac |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c2c72c7f1f1e1464fa361f64a7b618bc |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 07e6889b70ab561458e46326d9c2a88b, type: 3} |
|||
m_Name: HasHitHead |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: 41dbff2af0b6f7141a32bb464309ba69 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 953dea50bde69be4fb0df0c3a49eef08, type: 3} |
|||
m_Name: IsGrounded |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: c7258bdb2558a214f916c8b5b3c0fa1f |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: aea20a61197822e49aaa66318da39267, type: 3} |
|||
m_Name: IsHoldingJump |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: 620f4efd93744084a8ac9ba272f093dc |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: fc2d5ccac974a0d41a92a30245aa08eb, type: 3} |
|||
m_Name: IsMoving |
|||
m_EditorClassIdentifier: Assembly-CSharp::StartMovingConditionSO |
|||
_treshold: 0.02 |
|
|||
fileFormatVersion: 2 |
|||
guid: a79b812272ab8314aa305b39f9a2740a |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9352ebfadd39e754e86b2aa1daffdca0, type: 3} |
|||
m_Name: IsSliding |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: c5090b215e4f1594f9d1ef6680cd15bb |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8139f9f328ed1144690b7a9ffca2d5b4, type: 3} |
|||
m_Name: JumpHoldTimer |
|||
m_EditorClassIdentifier: |
|||
_timerLength: 0.4 |
|
|||
fileFormatVersion: 2 |
|||
guid: bf6a2f4642738ac4f8e84bcdf1cb5f93 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 804b3b4960b69144db0d6ee7bb8249bb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 35432205b9a6a374bbbfe6b7cac92179, type: 3} |
|||
m_Name: Idle |
|||
m_EditorClassIdentifier: |
|||
_actions: |
|||
- {fileID: 11400000, guid: bd85c54d16eb60c4c99504f1679af851, type: 2} |
|||
- {fileID: 11400000, guid: 47d9da417e68970419335f80f4395239, type: 2} |
|||
_transitions: |
|||
- {fileID: 11400000, guid: 15394873b380a284bbf425c98e1f7ff5, type: 2} |
|||
- {fileID: 11400000, guid: a397ed7ab7a1ef24082946a116ba98ed, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: e128814ff6dbf63449bbc4dc8b6dc066 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 35432205b9a6a374bbbfe6b7cac92179, type: 3} |
|||
m_Name: JumpAscending |
|||
m_EditorClassIdentifier: |
|||
_actions: |
|||
- {fileID: 11400000, guid: f1f9b67c2b957d74dae6555b3598ae49, type: 2} |
|||
- {fileID: 11400000, guid: 5d9c1bbe4ffcb2146a540998d17b665d, type: 2} |
|||
- {fileID: 11400000, guid: 47d9da417e68970419335f80f4395239, type: 2} |
|||
- {fileID: 11400000, guid: 096d532f9a47f3145892efa1c4322e72, type: 2} |
|||
_transitions: |
|||
- {fileID: 11400000, guid: 06d55bd43e60a1a469545b18bca1061c, type: 2} |
|||
- {fileID: 11400000, guid: d0d2423b580ea5a4789dcee21f62cba6, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0aa906b71b1b4504d950f5ee8e1f06e8 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 35432205b9a6a374bbbfe6b7cac92179, type: 3} |
|||
m_Name: JumpDescending |
|||
m_EditorClassIdentifier: |
|||
_actions: |
|||
- {fileID: 11400000, guid: f1f9b67c2b957d74dae6555b3598ae49, type: 2} |
|||
- {fileID: 11400000, guid: 5d442cfcb78da8b418d6ae3e93e5748e, type: 2} |
|||
- {fileID: 11400000, guid: 47d9da417e68970419335f80f4395239, type: 2} |
|||
- {fileID: 11400000, guid: 096d532f9a47f3145892efa1c4322e72, type: 2} |
|||
_transitions: |
|||
- {fileID: 11400000, guid: 426d4a126aac5f94abff16fd4fd22450, type: 2} |
|||
- {fileID: 11400000, guid: bdbd98a2bcdc25c47bdae39b7ab3bac6, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: c57ed1dc57a890943b2648ca8a581075 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 35432205b9a6a374bbbfe6b7cac92179, type: 3} |
|||
m_Name: Sliding |
|||
m_EditorClassIdentifier: |
|||
_actions: |
|||
- {fileID: 11400000, guid: 088f3e34793299349983d53aaf39e5e3, type: 2} |
|||
- {fileID: 11400000, guid: 9e558dc250163db40a4e1f7241ee15c2, type: 2} |
|||
- {fileID: 11400000, guid: 47d9da417e68970419335f80f4395239, type: 2} |
|||
- {fileID: 11400000, guid: 4badb7afa3370ba4d8a229584c5c744f, type: 2} |
|||
_transitions: |
|||
- {fileID: 11400000, guid: d65431b4fa02b494ab91bafd68cb5a8f, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4c2c0dc4f7ee62b4d95b20ac3dce281e |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 35432205b9a6a374bbbfe6b7cac92179, type: 3} |
|||
m_Name: Walking |
|||
m_EditorClassIdentifier: |
|||
_actions: |
|||
- {fileID: 11400000, guid: 6a9da1e686e8c3142bcbcc7ccb5bd5ac, type: 2} |
|||
- {fileID: 11400000, guid: bd85c54d16eb60c4c99504f1679af851, type: 2} |
|||
- {fileID: 11400000, guid: 47d9da417e68970419335f80f4395239, type: 2} |
|||
- {fileID: 11400000, guid: 096d532f9a47f3145892efa1c4322e72, type: 2} |
|||
_transitions: |
|||
- {fileID: 11400000, guid: 41433dadcfe624b41a29409bd2049c85, type: 2} |
|||
- {fileID: 11400000, guid: a397ed7ab7a1ef24082946a116ba98ed, type: 2} |
|||
- {fileID: 11400000, guid: 54b0ebefbe8767c41a7e981ea0857f68, type: 2} |
|||
- {fileID: 11400000, guid: 06d55bd43e60a1a469545b18bca1061c, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: 027d32476800b3543b2f5446a59054c8 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 7273e93cd813a8947b64537b38daed30 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: BeginJump |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: 0aa906b71b1b4504d950f5ee8e1f06e8, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: 620f4efd93744084a8ac9ba272f093dc, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: a397ed7ab7a1ef24082946a116ba98ed |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: BeginJumpDescent |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: c57ed1dc57a890943b2648ca8a581075, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 1 |
|||
Condition: {fileID: 11400000, guid: 620f4efd93744084a8ac9ba272f093dc, type: 2} |
|||
Operator: 1 |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: bf6a2f4642738ac4f8e84bcdf1cb5f93, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 06d55bd43e60a1a469545b18bca1061c |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: HitHead |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: c57ed1dc57a890943b2648ca8a581075, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: 41dbff2af0b6f7141a32bb464309ba69, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: d0d2423b580ea5a4789dcee21f62cba6 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: LandIdle |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: e128814ff6dbf63449bbc4dc8b6dc066, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: c7258bdb2558a214f916c8b5b3c0fa1f, type: 2} |
|||
Operator: 0 |
|||
- ExpectedResult: 1 |
|||
Condition: {fileID: 11400000, guid: a79b812272ab8314aa305b39f9a2740a, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: bdbd98a2bcdc25c47bdae39b7ab3bac6 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: LandWalking |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: 027d32476800b3543b2f5446a59054c8, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: c7258bdb2558a214f916c8b5b3c0fa1f, type: 2} |
|||
Operator: 0 |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: a79b812272ab8314aa305b39f9a2740a, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 426d4a126aac5f94abff16fd4fd22450 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: StartSliding |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: 4c2c0dc4f7ee62b4d95b20ac3dce281e, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: c5090b215e4f1594f9d1ef6680cd15bb, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 54b0ebefbe8767c41a7e981ea0857f68 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: StartWalking |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: 027d32476800b3543b2f5446a59054c8, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 0 |
|||
Condition: {fileID: 11400000, guid: a79b812272ab8314aa305b39f9a2740a, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 15394873b380a284bbf425c98e1f7ff5 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: StopSliding |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: e128814ff6dbf63449bbc4dc8b6dc066, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 1 |
|||
Condition: {fileID: 11400000, guid: c5090b215e4f1594f9d1ef6680cd15bb, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: d65431b4fa02b494ab91bafd68cb5a8f |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e1893bf30b6f554a9d80007ee336691, type: 3} |
|||
m_Name: StopWalking |
|||
m_EditorClassIdentifier: |
|||
_targetState: {fileID: 11400000, guid: e128814ff6dbf63449bbc4dc8b6dc066, type: 2} |
|||
_conditions: |
|||
- ExpectedResult: 1 |
|||
Condition: {fileID: 11400000, guid: a79b812272ab8314aa305b39f9a2740a, type: 2} |
|||
Operator: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 41433dadcfe624b41a29409bd2049c85 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5709933eec4549d4f9c4389785d44d3d |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "ApplyMovementVector", menuName = "State Machines/Actions/Apply Movement Vector")] |
|||
public class ApplyMovementVectorActionSO : StateActionSO<ApplyMovementVectorAction> { } |
|||
|
|||
public class ApplyMovementVectorAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
private CharacterController _characterController; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
_characterController = stateMachine.GetComponent<CharacterController>(); |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
_characterController.Move(_characterScript.movementVector * Time.deltaTime); |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "Ascend", menuName = "State Machines/Actions/Ascend")] |
|||
public class AscendActionSO : StateActionSO |
|||
{ |
|||
[Tooltip("The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity")] |
|||
[SerializeField] private float _initialJumpForce = 10f; |
|||
|
|||
protected override StateAction CreateAction() => new AscendAction(_initialJumpForce); |
|||
} |
|||
|
|||
public class AscendAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
private float _verticalMovement; |
|||
private float _gravityContributionMultiplier; |
|||
private float _initialJumpForce; |
|||
private const float GRAVITY_COMEBACK_MULTIPLIER = 15f; |
|||
private const float GRAVITY_DIVIDER = .6f; |
|||
private const float GRAVITY_MULTIPLIER = 5f; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public AscendAction(float initialJumpForce) |
|||
{ |
|||
_initialJumpForce = initialJumpForce; |
|||
} |
|||
|
|||
public override void OnStateEnter() |
|||
{ |
|||
_verticalMovement = _initialJumpForce; |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
_gravityContributionMultiplier += Time.deltaTime * GRAVITY_COMEBACK_MULTIPLIER; |
|||
_gravityContributionMultiplier *= GRAVITY_DIVIDER; //Reduce the gravity effect
|
|||
_verticalMovement += Physics.gravity.y * GRAVITY_MULTIPLIER * Time.deltaTime * _gravityContributionMultiplier; |
|||
//Note that even if it's added, the above value is negative due to Physics.gravity.y
|
|||
|
|||
_characterScript.movementVector.y = _verticalMovement; |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "Descend", menuName = "State Machines/Actions/Descend")] |
|||
public class DescendActionSO : StateActionSO |
|||
{ |
|||
protected override StateAction CreateAction() => new DescendAction(); |
|||
} |
|||
|
|||
public class DescendAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
private float _verticalMovement; |
|||
private const float GRAVITY_MULTIPLIER = 5f; |
|||
private const float MAX_FALL_SPEED = -50f; |
|||
private const float MAX_RISE_SPEED = 100f; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public override void OnStateEnter() |
|||
{ |
|||
_verticalMovement = _characterScript.movementVector.y; |
|||
_characterScript.jumpInput = false; //Prevents a double jump if the player keeps holding the jump button
|
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
_verticalMovement += Physics.gravity.y * GRAVITY_MULTIPLIER * Time.deltaTime; |
|||
//Note that even if it's added, the above value is negative due to Physics.gravity.y
|
|||
|
|||
//Cap the maximum so the player doesn't reach incredible speeds when freefalling from high positions
|
|||
_verticalMovement = Mathf.Clamp(_verticalMovement, MAX_FALL_SPEED, MAX_RISE_SPEED); |
|||
|
|||
_characterScript.movementVector.y = _verticalMovement; |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "GroundGravity", menuName = "State Machines/Actions/Ground Gravity")] |
|||
public class GroundGravityActionSO : StateActionSO |
|||
{ |
|||
[Tooltip("Vertical movement pulling down the player to keep it anchored to the ground.")] |
|||
[SerializeField] private float _verticalPull = -5f; |
|||
|
|||
protected override StateAction CreateAction() => new GroundGravityAction(_verticalPull); |
|||
} |
|||
|
|||
public class GroundGravityAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
private float _verticalPull; |
|||
|
|||
public GroundGravityAction(float slideSpeed) |
|||
{ |
|||
_verticalPull = slideSpeed; |
|||
} |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
_characterScript.movementVector.y = _verticalPull; |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "HorizontalMove", menuName = "State Machines/Actions/Horizontal Move")] |
|||
public class HorizontalMoveActionSO : StateActionSO |
|||
{ |
|||
[Tooltip("Horizontal XZ plane speed multiplier")] [SerializeField] private float _speed = 8f; |
|||
|
|||
protected override StateAction CreateAction() => new WalkAction(_speed); |
|||
} |
|||
|
|||
public class WalkAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
private float _speed; |
|||
|
|||
public WalkAction(float speed) |
|||
{ |
|||
_speed = speed; |
|||
} |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
_characterScript.movementVector.x = _characterScript.movementInput.x * _speed; |
|||
_characterScript.movementVector.z = _characterScript.movementInput.z * _speed; |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "RotateAction", menuName = "State Machines/Actions/Rotate")] |
|||
public class RotateActionSO : StateActionSO |
|||
{ |
|||
[Tooltip("Smoothing for rotating the character to their movement direction")] [SerializeField] private float _turnSmoothTime = 0.2f; |
|||
protected override StateAction CreateAction() => new RotateAction(_turnSmoothTime); |
|||
} |
|||
|
|||
public class RotateAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
private Transform _transform; |
|||
|
|||
private float _turnSmoothTime; |
|||
private float _turnSmoothSpeed; //Used by Mathf.SmoothDampAngle to smoothly rotate the character to their movement direction
|
|||
private const float ROTATION_TRESHOLD = .02f; // Used to prevent NaN result causing rotation in a non direction
|
|||
|
|||
public RotateAction(float turnSmoothTime) |
|||
{ |
|||
_turnSmoothTime = turnSmoothTime; |
|||
} |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
_transform = stateMachine.GetComponent<Transform>(); |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
Vector3 horizontalMovement = _characterScript.movementVector; |
|||
horizontalMovement.y = 0f; |
|||
|
|||
if (horizontalMovement.sqrMagnitude >= ROTATION_TRESHOLD) |
|||
{ |
|||
float targetRotation = Mathf.Atan2(_characterScript.movementVector.x, _characterScript.movementVector.z) * Mathf.Rad2Deg; |
|||
_transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle( |
|||
_transform.eulerAngles.y, |
|||
targetRotation, |
|||
ref _turnSmoothSpeed, |
|||
_turnSmoothTime); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "SlideAction", menuName = "State Machines/Actions/Slide")] |
|||
public class SlideActionSO : StateActionSO |
|||
{ |
|||
[Tooltip("Sliding speed on the XZ plane.")] |
|||
[SerializeField] private float _slideSpeed = 6f; |
|||
|
|||
protected override StateAction CreateAction() => new SlideAction(_slideSpeed); |
|||
} |
|||
|
|||
public class SlideAction : StateAction |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
private float _slideSpeed; |
|||
|
|||
public SlideAction(float slideSpeed) |
|||
{ |
|||
_slideSpeed = slideSpeed; |
|||
} |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public override void OnUpdate() |
|||
{ |
|||
Vector3 hitNormal = _characterScript.lastHit.normal; |
|||
_characterScript.movementVector.x = (1f - hitNormal.y) * hitNormal.x * _slideSpeed; |
|||
_characterScript.movementVector.z = (1f - hitNormal.y) * hitNormal.z * _slideSpeed; |
|||
} |
|||
|
|||
public override void OnStateExit() |
|||
{ |
|||
_characterScript.movementVector = Vector3.zero; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 59fdd8de429b64e42b395e599c7af313 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "HasHitHead", menuName = "State Machines/Conditions/Has Hit the Head")] |
|||
public class HasHitHeadConditionSO : StateConditionSO<HasHitHeadCondition> { } |
|||
|
|||
public class HasHitHeadCondition : Condition |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
private CharacterController _characterController; |
|||
private Transform _transform; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_transform = stateMachine.GetComponent<Transform>(); |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
_characterController = stateMachine.GetComponent<CharacterController>(); |
|||
} |
|||
|
|||
public override bool Statement() |
|||
{ |
|||
bool isMovingUpwards = _characterScript.movementVector.y > 0f; |
|||
if (isMovingUpwards) |
|||
{ |
|||
// Making sure the collision is near the top of the head
|
|||
float permittedDistance = _characterController.radius / 2f; |
|||
float topPositionY = _transform.position.y + _characterController.height; |
|||
float distance = Mathf.Abs(_characterScript.lastHit.point.y - topPositionY); |
|||
if (distance <= permittedDistance) |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override void OnStateExit() |
|||
{ |
|||
_characterScript.jumpInput = false; |
|||
_characterScript.movementVector.y = 0f; |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "IsGrounded", menuName = "State Machines/Conditions/Is Character Controller Grounded")] |
|||
public class IsCharacterControllerGroundedConditionSO : StateConditionSO<IsCharacterControllerGroundedCondition> { } |
|||
|
|||
public class IsCharacterControllerGroundedCondition : Condition |
|||
{ |
|||
private CharacterController _characterController; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterController = stateMachine.GetComponent<CharacterController>(); |
|||
} |
|||
|
|||
public override bool Statement() => _characterController.isGrounded; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 953dea50bde69be4fb0df0c3a49eef08 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "IsHoldingJump", menuName = "State Machines/Conditions/Is Holding Jump")] |
|||
public class IsHoldingJumpConditionSO : StateConditionSO<IsHoldingJumpCondition> { } |
|||
|
|||
public class IsHoldingJumpCondition : Condition |
|||
{ |
|||
//Component references
|
|||
private Character _characterScript; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public override bool Statement() => _characterScript.jumpInput; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: aea20a61197822e49aaa66318da39267 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UOP1.StateMachine; |
|||
using UOP1.StateMachine.ScriptableObjects; |
|||
|
|||
[CreateAssetMenu(fileName = "StartedMoving", menuName = "State Machines/Conditions/Started Moving")] |
|||
public class IsMovingConditionSO : StateConditionSO |
|||
{ |
|||
[SerializeField] private float _treshold = 0.02f; |
|||
|
|||
protected override Condition CreateCondition() => new IsMovingCondition(_treshold); |
|||
} |
|||
|
|||
public class IsMovingCondition : Condition |
|||
{ |
|||
private float _treshold; |
|||
private Character _characterScript; |
|||
|
|||
public override void Awake(StateMachine stateMachine) |
|||
{ |
|||
_characterScript = stateMachine.GetComponent<Character>(); |
|||
} |
|||
|
|||
public IsMovingCondition(float treshold) |
|||
{ |
|||
_treshold = treshold; |
|||
} |
|||
|
|||
public override bool Statement() |
|||
{ |
|||
Vector3 movementVector = _characterScript.movementInput; |
|||
movementVector.y = 0f; |
|||
return movementVector.sqrMagnitude > _treshold; |
|||
} |
|||
|
|||
public override void OnStateExit() |
|||
{ |
|||
_characterScript.movementVector = Vector3.zero; |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue