浏览代码

Now we have 2 face protagonist actions specific to NPC and critters

/main
Amel Negra 4 年前
当前提交
d77d34d4
共有 17 个文件被更改,包括 123 次插入74 次删除
  1. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Alert.asset
  2. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Fighting.asset
  3. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Reloading.asset
  4. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset
  5. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/States/ListenToProtagonist.asset
  6. 2
      UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/States/TalkToProtagonist.asset
  7. 15
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/CritterFaceProtagonist.asset
  8. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/CritterFaceProtagonist.asset.meta
  9. 38
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/CritterFaceProtagonistSO.cs
  10. 11
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/CritterFaceProtagonistSO.cs.meta
  11. 45
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/NPCFaceProtagonistSO.cs
  12. 15
      UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/FaceProtagonist.asset
  13. 8
      UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/FaceProtagonist.asset.meta
  14. 45
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/FaceProtagonistSO.cs
  15. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset
  16. 0
      /UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/NPCFaceProtagonistSO.cs.meta
  17. 0
      /UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset.meta

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Alert.asset


m_Name: Alert
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 6f2fd87f078fefb48ad59ba0e24df91e, type: 2}
- {fileID: 11400000, guid: 4b49e9d3d876bba458ffce6292758942, type: 2}
- {fileID: 11400000, guid: b3e528708050add49837de9f6a3d6b48, type: 2}
- {fileID: 11400000, guid: 46af8bb2ed6efed4ab26d05dfc1b560f, type: 2}
- {fileID: 11400000, guid: 865756d55a4aa2644be7ab9959c408fb, type: 2}

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Fighting.asset


m_Name: Fighting
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 6f2fd87f078fefb48ad59ba0e24df91e, type: 2}
- {fileID: 11400000, guid: 4b49e9d3d876bba458ffce6292758942, type: 2}
- {fileID: 11400000, guid: 071fecb332ceabb4ba338d86d34759ac, type: 2}

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/SlimeRockCritter/States/Reloading.asset


m_Name: Reloading
m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 6f2fd87f078fefb48ad59ba0e24df91e, type: 2}
- {fileID: 11400000, guid: 4b49e9d3d876bba458ffce6292758942, type: 2}
- {fileID: 11400000, guid: 071fecb332ceabb4ba338d86d34759ac, type: 2}

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset


m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ce256746129817c4794d5d8a76387975, type: 3}
m_Name: FaceProtagonist
m_Name: NPCFaceProtagonist
m_EditorClassIdentifier:
playerAnchor: {fileID: 11400000, guid: 35fc4039342b6ba458d0d4429e89ee74, type: 2}

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/States/ListenToProtagonist.asset


m_EditorClassIdentifier:
_actions:
- {fileID: 11400000, guid: 098a951ce0fcb154bb9cb4900665dd9b, type: 2}
- {fileID: 11400000, guid: e78eaf21cfb04df4bbccd2f3eda7749c, type: 2}
- {fileID: 11400000, guid: 6f2fd87f078fefb48ad59ba0e24df91e, type: 2}

2
UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/States/TalkToProtagonist.asset


_actions:
- {fileID: 11400000, guid: 4ddcdf01c7784f84fa7b869c64b7d86e, type: 2}
- {fileID: 11400000, guid: 098a951ce0fcb154bb9cb4900665dd9b, type: 2}
- {fileID: 11400000, guid: e78eaf21cfb04df4bbccd2f3eda7749c, type: 2}
- {fileID: 11400000, guid: 6f2fd87f078fefb48ad59ba0e24df91e, type: 2}
- {fileID: 11400000, guid: 0169c310b4cc2fe4091c9913e5aacf7e, type: 2}

15
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/CritterFaceProtagonist.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: 967d6776ef9f1c048a2541e5e5ad0158, type: 3}
m_Name: CritterFaceProtagonist
m_EditorClassIdentifier:
playerAnchor: {fileID: 11400000, guid: 35fc4039342b6ba458d0d4429e89ee74, type: 2}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/CritterFaceProtagonist.asset.meta


fileFormatVersion: 2
guid: 4b49e9d3d876bba458ffce6292758942
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

38
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/CritterFaceProtagonistSO.cs


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(fileName = "CritterFaceProtagonist", menuName = "State Machines/Actions/Critter Face Protagonist")]
public class CritterFaceProtagonistSO : StateActionSO
{
public TransformAnchor playerAnchor;
protected override StateAction CreateAction() => new CritterFaceProtagonist();
}
public class CritterFaceProtagonist : StateAction
{
TransformAnchor _protagonist;
Transform _actor;
public override void Awake(StateMachine stateMachine)
{
_actor = stateMachine.transform;
_protagonist = ((CritterFaceProtagonistSO)OriginSO).playerAnchor;
}
public override void OnUpdate()
{
if (_protagonist.isSet)
{
Vector3 relativePos = _protagonist.Transform.position - _actor.position;
relativePos.y = 0f; // Force rotation to be only on Y axis.
Quaternion rotation = Quaternion.LookRotation(relativePos);
_actor.rotation = rotation;
}
}
public override void OnStateEnter()
{
}
}

11
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/CritterFaceProtagonistSO.cs.meta


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

45
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/NPCFaceProtagonistSO.cs


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(fileName = "NPCFaceProtagonist", menuName = "State Machines/Actions/NPC Face Protagonist")]
public class NPCFaceProtagonistSO : StateActionSO
{
public TransformAnchor playerAnchor;
protected override StateAction CreateAction() => new NPCFaceProtagonist();
}
public class NPCFaceProtagonist : StateAction
{
TransformAnchor _protagonist;
Transform _actor;
Quaternion rotationOnEnter;
public override void Awake(StateMachine stateMachine)
{
_actor = stateMachine.transform;
_protagonist = ((NPCFaceProtagonistSO)OriginSO).playerAnchor;
rotationOnEnter = _actor.rotation;
}
public override void OnUpdate()
{
if (_protagonist.isSet)
{
Vector3 relativePos = _protagonist.Transform.position - _actor.position;
relativePos.y = 0f; // Force rotation to be only on Y axis.
Quaternion rotation = Quaternion.LookRotation(relativePos);
_actor.rotation = rotation;
}
}
public override void OnStateEnter()
{
}
public override void OnStateExit()
{
_actor.rotation = rotationOnEnter;
}
}

15
UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/FaceProtagonist.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: ce256746129817c4794d5d8a76387975, type: 3}
m_Name: FaceProtagonist
m_EditorClassIdentifier:
playerAnchor: {fileID: 11400000, guid: 35fc4039342b6ba458d0d4429e89ee74, type: 2}

8
UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/FaceProtagonist.asset.meta


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

45
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/FaceProtagonistSO.cs


using UnityEngine;
using UOP1.StateMachine;
using UOP1.StateMachine.ScriptableObjects;
[CreateAssetMenu(fileName = "FaceProtagonist", menuName = "State Machines/Actions/Face Protagonist")]
public class FaceProtagonistSO : StateActionSO
{
public TransformAnchor playerAnchor;
protected override StateAction CreateAction() => new FaceProtagonist();
}
public class FaceProtagonist : StateAction
{
TransformAnchor _protagonist;
Transform _actor;
Quaternion rotationOnEnter;
public override void Awake(StateMachine stateMachine)
{
_actor = stateMachine.transform;
_protagonist = ((FaceProtagonistSO)OriginSO).playerAnchor;
rotationOnEnter = _actor.rotation;
}
public override void OnUpdate()
{
if (_protagonist.isSet)
{
Vector3 relativePos = _protagonist.Transform.position - _actor.position;
relativePos.y = 0f; // Force rotation to be only on Y axis.
Quaternion rotation = Quaternion.LookRotation(relativePos);
_actor.rotation = rotation;
}
}
public override void OnStateEnter()
{
}
public override void OnStateExit()
{
_actor.rotation = rotationOnEnter;
}
}

/UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/FaceProtagonist.asset → /UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset

/UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/FaceProtagonistSO.cs.meta → /UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/NPCFaceProtagonistSO.cs.meta

/UOP1_Project/Assets/ScriptableObjects/StateMachine/Critters/Actions/FaceProtagonist.asset.meta → /UOP1_Project/Assets/ScriptableObjects/StateMachine/NPC/Actions/NPCFaceProtagonist.asset.meta

正在加载...
取消
保存