浏览代码

Removed script Character, moved StateMachine SOs

/main
Ciro Continisio 4 年前
当前提交
7be88cca
共有 42 个文件被更改,包括 189 次插入121 次删除
  1. 16
      UOP1_Project/Assets/Art/Characters/PigChef/Animation/Pig.controller
  2. 20
      UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab
  3. 21
      UOP1_Project/Assets/Scripts/Characters/Protagonist.cs
  4. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/ApplyMovementVectorActionSO.cs
  5. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs
  6. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/DescendActionSO.cs
  7. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/GroundGravityActionSO.cs
  8. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/HorizontalMoveActionSO.cs
  9. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/RotateActionSO.cs
  10. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/SlideActionSO.cs
  11. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs
  12. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsHoldingJumpConditionSO.cs
  13. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsMovingConditionSO.cs
  14. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsSlidingConditionSO.cs
  15. 6
      UOP1_Project/Assets/Scripts/Input/InputReader.cs
  16. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset
  17. 4
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/JumpAscending.asset
  18. 4
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Sliding.asset
  19. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Idle.asset
  20. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Walking.asset
  21. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine.meta
  22. 16
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_False.asset
  23. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_False.asset.meta
  24. 16
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_True.asset
  25. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_True.asset.meta
  26. 16
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_False.asset
  27. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_False.asset.meta
  28. 16
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_True.asset
  29. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_True.asset.meta
  30. 16
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Talk.asset
  31. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Talk.asset.meta
  32. 38
      UOP1_Project/Assets/Scripts/Characters/Character.cs
  33. 11
      UOP1_Project/Assets/Scripts/Characters/Character.cs.meta
  34. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist.meta
  35. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist
  36. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset.meta
  37. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset
  38. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_False.asset
  39. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_False.asset.meta
  40. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_True.asset
  41. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_True.asset.meta

16
UOP1_Project/Assets/Art/Characters/PigChef/Animation/Pig.controller


m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1

m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.7580645
m_HasExitTime: 0

m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1

m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.98747915
m_HasExitTime: 0

m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.98747915
m_HasExitTime: 0

m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.7580645
m_HasExitTime: 0

20
UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab


m_Height: 1.3
m_Radius: 0.3
m_SlopeLimit: 45
m_StepOffset: 0.5
m_StepOffset: 0.05
m_SkinWidth: 0.02
m_MinMoveDistance: 0.001
m_Center: {x: 0, y: 0.65, z: 0}

appendConditionsInfo: 1
appendActionsInfo: 1
currentState:
--- !u!114 &3722006066079062647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 309633228405838073}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4eb0e4f8f5e39624ea81504bf968dcce, type: 3}
m_Name:
m_EditorClassIdentifier:
jumpInput: 0
movementInput: {x: 0, y: 0, z: 0}
movementVector: {x: 0, y: 0, z: 0}
--- !u!114 &5557640735889932260
MonoBehaviour:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
_inputReader: {fileID: 11400000, guid: 945ec0365077176418488737deed54be, type: 2}
gameplayCamera: {fileID: 0}
jumpInput: 0
movementInput: {x: 0, y: 0, z: 0}
movementVector: {x: 0, y: 0, z: 0}
--- !u!1001 &616254372594363816
PrefabInstance:
m_ObjectHideFlags: 0

21
UOP1_Project/Assets/Scripts/Characters/Protagonist.cs


[SerializeField] private InputReader _inputReader = default;
public Transform gameplayCamera;
private Character _charScript;
private Protagonist _charScript;
//These fields are manipulated by the StateMachine actions
[HideInInspector] public bool jumpInput;
[HideInInspector] public Vector3 movementInput; //Initial input coming from the Protagonist script
[HideInInspector] public Vector3 movementVector; //Final movement vector, manipulated by the StateMachine actions
[HideInInspector] public ControllerColliderHit lastHit;
_charScript = GetComponent<Character>();
_charScript = GetComponent<Protagonist>();
}
private void OnControllerColliderHit(ControllerColliderHit hit)
{
lastHit = hit;
}
//Adds listeners for events being triggered in the InputReader script

Vector3 adjustedMovement = cameraRight.normalized * _previousMovementInput.x +
cameraForward.normalized * _previousMovementInput.y;
_charScript.Move(Vector3.ClampMagnitude(adjustedMovement, 1f));
movementInput = Vector3.ClampMagnitude(adjustedMovement, 1f);
}
//---- EVENT LISTENERS ----

private void OnJumpInitiated()
{
_charScript.Jump();
jumpInput = true;
_charScript.CancelJump();
jumpInput = false;
}
}

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/ApplyMovementVectorActionSO.cs


public class ApplyMovementVectorAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
_characterController = stateMachine.GetComponent<CharacterController>();
}

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs


public class AscendAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private float _verticalMovement;
private float _gravityContributionMultiplier;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public AscendAction(float initialJumpForce)

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/DescendActionSO.cs


public class DescendAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private float _verticalMovement;
private const float GRAVITY_MULTIPLIER = 5f;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public override void OnStateEnter()

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/GroundGravityActionSO.cs


public class GroundGravityAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private float _verticalPull;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public override void OnUpdate()

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/HorizontalMoveActionSO.cs


public class WalkAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private float _speed;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public override void OnUpdate()

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/RotateActionSO.cs


public class RotateAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private Transform _transform;
private float _turnSmoothTime;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
_transform = stateMachine.GetComponent<Transform>();
}

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/SlideActionSO.cs


public class SlideAction : StateAction
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private float _slideSpeed;

public override void Awake(StateMachine stateMachine)
{
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public override void OnUpdate()

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs


public class HasHitHeadCondition : Condition
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
private CharacterController _characterController;
private Transform _transform;

_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
_characterController = stateMachine.GetComponent<CharacterController>();
}

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsHoldingJumpConditionSO.cs


public class IsHoldingJumpCondition : Condition
{
//Component references
private Character _characterScript;
private Protagonist _characterScript;
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
protected override bool Statement() => _characterScript.jumpInput;

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsMovingConditionSO.cs


public class IsMovingCondition : Condition
{
private float _treshold;
private Character _characterScript;
private Protagonist _characterScript;
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
public IsMovingCondition(float treshold)

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsSlidingConditionSO.cs


public class IsSlidingCondition : Condition
{
private CharacterController _characterController;
private Character _characterScript;
private Protagonist _characterScript;
_characterScript = stateMachine.GetComponent<Character>();
_characterScript = stateMachine.GetComponent<Protagonist>();
}
protected override bool Statement()

6
UOP1_Project/Assets/Scripts/Input/InputReader.cs


[CreateAssetMenu(fileName = "InputReader", menuName = "Game/Input Reader")]
public class InputReader : ScriptableObject, GameInput.IGameplayActions, GameInput.IDialoguesActions
{
// gameplay
// Gameplay
public event UnityAction interactEvent;
public event UnityAction extraActionEvent;
public event UnityAction interactEvent; // Used to talk, pickup objects, interact with tools like the cooking cauldron
public event UnityAction extraActionEvent; // Used to bring up the inventory
public event UnityAction pauseEvent;
public event UnityAction<Vector2> moveEvent;
public event UnityAction<Vector2, bool> cameraMoveEvent;

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset


m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 872cbaa965d1f6e4e98365d74e2060df, type: 3}
m_Name: CharacterTransitionTable
m_Name: PigChef_TransitionTable
m_EditorClassIdentifier:
_transitions:
- FromState: {fileID: 11400000, guid: e128814ff6dbf63449bbc4dc8b6dc066, type: 2}

4
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/JumpAscending.asset


m_Name: JumpAscending
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 00abdcc5c2b7e3d4d8855f1a84801fae, type: 2}
_transitions:
- {fileID: 11400000, guid: 06d55bd43e60a1a469545b18bca1061c, type: 2}
- {fileID: 11400000, guid: d0d2423b580ea5a4789dcee21f62cba6, type: 2}

4
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Sliding.asset


m_Name: Sliding
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 99b804881a9d5744fb4784c30000c0b5, type: 2}
- {fileID: 11400000, guid: c0d0573a78e4c6245ab9676e7af35880, type: 2}
_transitions:
- {fileID: 11400000, guid: d65431b4fa02b494ab91bafd68cb5a8f, type: 2}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Idle.asset


m_Name: Idle
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 99b804881a9d5744fb4784c30000c0b5, type: 2}
- {fileID: 11400000, guid: c0d0573a78e4c6245ab9676e7af35880, type: 2}
- {fileID: 11400000, guid: c0d0573a78e4c6245ab9676e7af35880, type: 2}
_transitions:
- {fileID: 11400000, guid: 15394873b380a284bbf425c98e1f7ff5, type: 2}
- {fileID: 11400000, guid: a397ed7ab7a1ef24082946a116ba98ed, type: 2}
- {fileID: 11400000, guid: 06d55bd43e60a1a469545b18bca1061c, type: 2}
- {fileID: 11400000, guid: 54b0ebefbe8767c41a7e981ea0857f68, type: 2}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Walking.asset


m_Name: Walking
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 99b804881a9d5744fb4784c30000c0b5, type: 2}
- {fileID: 11400000, guid: 201885673bd707f4c9b5f3a92eca204f, type: 2}
- {fileID: 11400000, guid: 201885673bd707f4c9b5f3a92eca204f, 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}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine.meta


fileFormatVersion: 2
guid: f78547c01850b0545bb7b094db4bef55
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_False.asset


%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: 4c70afd7f911db7449d578cc18700875, type: 3}
m_Name: SetIsAirborne_False
m_EditorClassIdentifier:
_parameterName: IsAirborne
_newValue: 0

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_False.asset.meta


fileFormatVersion: 2
guid: 99b804881a9d5744fb4784c30000c0b5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

16
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_True.asset


%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: 4c70afd7f911db7449d578cc18700875, type: 3}
m_Name: SetIsAirborne_True
m_EditorClassIdentifier:
_parameterName: IsAirborne
_newValue: 1

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsAirborne_True.asset.meta


fileFormatVersion: 2
guid: 00abdcc5c2b7e3d4d8855f1a84801fae
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

16
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_False.asset


%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: 4c70afd7f911db7449d578cc18700875, type: 3}
m_Name: SetIsTalking_True
m_EditorClassIdentifier:
_parameterName: IsTalking
_newValue: 1

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_False.asset.meta


fileFormatVersion: 2
guid: 7ad91f04f328d9d42a677833fa39748d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

16
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_True.asset


%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: 4c70afd7f911db7449d578cc18700875, type: 3}
m_Name: SetIsTalking_True
m_EditorClassIdentifier:
_parameterName: IsTalking
_newValue: 1

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetIsTalking_True.asset.meta


fileFormatVersion: 2
guid: 988d4d429b1d3484e8b15f3735c804ec
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

16
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Talk.asset


%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: Talk
m_EditorClassIdentifier:
_actions:
- {fileID: 0}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/States/Talk.asset.meta


fileFormatVersion: 2
guid: ff92a93d8a8694247b507d811c88e402
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

38
UOP1_Project/Assets/Scripts/Characters/Character.cs


using UnityEngine;
using UnityEngine.PlayerLoop;
/// <summary>
/// <para>This class is a data holder that the <c>StateMachine</c> class uses to deposit data that needs to be shared between states.
/// Ideally, both the player character and NPCs can use this component to drive locomotion.</para>
/// <para>Also used to listen to the native Unity Message <c>OnControllerColliderHit</c> from the <c>CharacterController</c> component,
/// which requires a <c>MonoBehaviour</c> to be listened to.</para>
/// </summary>
public class Character : MonoBehaviour
{
//These fields are manipulated by the StateMachine actions
[HideInInspector] public bool jumpInput;
[HideInInspector] public Vector3 movementInput; //Initial input coming from the Protagonist script
[HideInInspector] public Vector3 movementVector; //Final movement vector, manipulated by the StateMachine actions
[HideInInspector] public ControllerColliderHit lastHit;
private void OnControllerColliderHit(ControllerColliderHit hit)
{
lastHit = hit;
}
//---- COMMANDS ISSUED BY OTHER SCRIPTS ----
public void Move(Vector3 movement)
{
movementInput = movement;
}
public void Jump()
{
jumpInput = true;
}
public void CancelJump()
{
jumpInput = false;
}
}

11
UOP1_Project/Assets/Scripts/Characters/Character.cs.meta


fileFormatVersion: 2
guid: 4eb0e4f8f5e39624ea81504bf968dcce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

/UOP1_Project/Assets/ScriptableObjects/Protagonist.meta → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist.meta

/UOP1_Project/Assets/ScriptableObjects/Protagonist → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/CharacterTransitionTable.asset.meta → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset.meta

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/CharacterTransitionTable.asset → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/PigChef_TransitionTable.asset

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalkingToFalse.asset → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_False.asset

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalkingToFalse.asset.meta → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_False.asset.meta

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalkingToTrue.asset → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_True.asset

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalkingToTrue.asset.meta → /UOP1_Project/Assets/ScriptableObjects/StateMachine/Protagonist/Actions/SetWalking_True.asset.meta

正在加载...
取消
保存