Compare commits

...

2 Commits

Author SHA1 Message Date
93aad738cf Merge branch 'main' of http://192.168.2.19:3000/hyskai/_xiaofang 2024-10-22 17:37:52 +08:00
c14ca68b16 ADD 2024-10-22 17:37:42 +08:00
7 changed files with 2777 additions and 49 deletions

View File

@ -1,5 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-5083329074022439226
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: Recuse
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -1085241712214742412}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.57865167
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-2928487774769089836
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: Recuse
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5494399718017335990}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.9292453
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-1333848842658168751
AnimatorStateMachine:
serializedVersion: 6
@ -11,17 +61,49 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -963242654641360267}
m_Position: {x: 70, y: 140, z: 0}
m_Position: {x: -40, y: 130, z: 0}
- serializedVersion: 1
m_State: {fileID: 5494399718017335990}
m_Position: {x: 310, y: 120, z: 0}
- serializedVersion: 1
m_State: {fileID: -1085241712214742412}
m_Position: {x: 310, y: 220, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: -120, y: 210, z: 0}
m_AnyStatePosition: {x: -30, y: -20, z: 0}
m_EntryPosition: {x: -30, y: 260, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -963242654641360267}
--- !u!1102 &-1085241712214742412
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New State
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
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: -203655887218126122, guid: 4f5096cf35822b94cacebf7fb5d86d34, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-963242654641360267
AnimatorState:
serializedVersion: 6
@ -32,7 +114,8 @@ AnimatorState:
m_Name: dead
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -2928487774769089836}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -56,7 +139,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0}
m_Name: Npc
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorParameters:
- m_Name: Recuse
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -70,3 +159,30 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &5494399718017335990
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: run
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -5083329074022439226}
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: fe763b5e709308f4085e998069974f5e, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2c4a835a9676e1a478c77d64f472c3ec
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -673,7 +673,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &174502147
PrefabInstance:
@ -1272,7 +1272,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &339787257
GameObject:
@ -2087,7 +2087,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &542563896
GameObject:
@ -2334,7 +2334,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &575870043
PrefabInstance:
@ -2723,7 +2723,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 17
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &677470297
PrefabInstance:
@ -2919,7 +2919,7 @@ Transform:
- {fileID: 1629676686}
- {fileID: 1389580918}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &717374030
GameObject:
@ -3196,7 +3196,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7104765112034956015, guid: 6815aad4cd6cb734a9d63a7210677333, type: 3}
propertyPath: m_RootOrder
value: 9
value: 10
objectReference: {fileID: 0}
- target: {fileID: 7104765112034956015, guid: 6815aad4cd6cb734a9d63a7210677333, type: 3}
propertyPath: m_LocalPosition.x
@ -3398,7 +3398,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &855778351
PrefabInstance:
@ -3737,7 +3737,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &996888828
GameObject:
@ -3769,7 +3769,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &996888830
MonoBehaviour:
@ -4044,7 +4044,7 @@ RectTransform:
m_Children:
- {fileID: 891617942}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -6925,6 +6925,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1462883182}
m_CullTransparentMesh: 1
--- !u!1 &1469954941
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1469954942}
m_Layer: 0
m_Name: mubiao
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1469954942
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1469954941}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1471280777
PrefabInstance:
m_ObjectHideFlags: 0
@ -7016,7 +7047,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 16
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1500884554
PrefabInstance:
@ -7172,7 +7203,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1001 &1538731171
PrefabInstance:
@ -8800,7 +8831,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 15
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1911115496
GameObject:
@ -9321,7 +9352,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2082736079
GameObject:
@ -9418,6 +9449,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: f838330c717b3fc449cdb0e9fd2ea841, type: 3}
m_PrefabInstance: {fileID: 2102592295}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1242008297200351719 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5795828957522809712, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
m_PrefabInstance: {fileID: 4706987623060023959}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2548037666199698154
PrefabInstance:
m_ObjectHideFlags: 0
@ -9427,7 +9463,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 2548037664796047208, guid: 9e4797c6e2ce28c4a9d37a399f4151e2, type: 3}
propertyPath: m_RootOrder
value: 8
value: 9
objectReference: {fileID: 0}
- target: {fileID: 2548037664796047208, guid: 9e4797c6e2ce28c4a9d37a399f4151e2, type: 3}
propertyPath: m_LocalPosition.x
@ -9518,9 +9554,13 @@ PrefabInstance:
propertyPath: m_Name
value: Capsule
objectReference: {fileID: 0}
- target: {fileID: 2907630901887348949, guid: cb61a92f105ea18418e946bf54862340, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2907630901887348954, guid: cb61a92f105ea18418e946bf54862340, type: 3}
propertyPath: m_RootOrder
value: 11
value: 12
objectReference: {fileID: 0}
- target: {fileID: 2907630901887348954, guid: cb61a92f105ea18418e946bf54862340, type: 3}
propertyPath: m_LocalPosition.x
@ -9564,3 +9604,98 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cb61a92f105ea18418e946bf54862340, type: 3}
--- !u!1001 &4706987623060023959
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 992225417846608816, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 4c604a8ba818eb24396a44c2f341fa66, type: 2}
- target: {fileID: 992225417846608816, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5795828957522809712, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_Name
value: Vang
objectReference: {fileID: 0}
- target: {fileID: 5795828957522809712, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalPosition.x
value: -2.88
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalPosition.y
value: 0.010002136
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalPosition.z
value: 21.57
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6567720597980285386, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2c4a835a9676e1a478c77d64f472c3ec, type: 3}
--- !u!136 &5519024520137767208
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242008297200351719}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
m_Radius: 2
m_Height: 2.29
m_Direction: 1
m_Center: {x: 0, y: 1.09, z: 0}
--- !u!114 &5519024520137767209
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242008297200351719}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea3c4e24ebc42194181651236cdf30f1, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -226,8 +226,8 @@ public class CharacterControl : MonoBehaviour
{
yield return new WaitForSeconds(2);
Characterain.SetSkillAin(CharacterSkill.NoSkill);
cha.GetComponent<RecuseNpc>().Setnpcstate(NpcState.Healthy);
//cha = null;
cha.GetComponent<RecuseNpc>().Setnpcstate();
}
/* public NpcState Setnpcstate()

View File

@ -11,19 +11,19 @@ public class Resurrection : MonoBehaviour
// Start is called before the first frame update
void Start()
{
ga =(GameObject)Resources.Load("Character/Capsule");//从resousce资源中加载npc
ga =(GameObject)Resources.Load("Character/Vang");//从resousce资源中加载npc
Init();
}
private void Init()
{
//for (int i = 0; i <3; i++)
//{
// GameObject instance = (GameObject)Instantiate(ga);//实例化npc
// int a = Random.Range(0,5);//用随机数保证出生位置的随机性
// Vector3 va = re[a].transform.position; //创建局部变量用来保存出生点的位置信息
// instance.transform.position = va;
//}
for (int i = 0; i < 3; i++)
{
GameObject instance = (GameObject)Instantiate(ga);//实例化npc
int a = Random.Range(0, 5);//用随机数保证出生位置的随机性
Vector3 va = re[a].transform.position; //创建局部变量用来保存出生点的位置信息
instance.transform.position = va;
}
}

View File

@ -3,42 +3,75 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public enum NpcState
{
Injuried, //受伤
Healthy//健康
public enum Npcstate
{
idle,
dead,
healthy
}
public class RecuseNpc : MonoBehaviour
{
private Button recusebtn;
private CharacterControl chain;
private NpcState ns = NpcState.Injuried;
private bool statebool = false;
private Animator anim;
private Npcstate nstate = Npcstate.dead;
private bool movebool = false;
private Transform target;
private void Awake()
{
recusebtn = GameObject.Find("Canvas/Recuse").GetComponent<Button>();
anim = this.GetComponent<Animator>();
target = GameObject.Find("mubiao").GetComponent<Transform>();
}
private void OnTriggerEnter(Collider other)
private void OnTriggerEnter(Collider other)//通过触发器得到对应的救援组人员标签是否显现出UI
{
if(other.name == "Man")
recusebtn.gameObject.SetActive(true);
chain = other.GetComponent<CharacterControl>();
if (statebool) return;
other.GetComponent<CharacterControl>().cha = this.gameObject ;
}
public void Setnpcstate(NpcState npcState)
{
this.transform.Translate(Vector3.forward);
Debug.Log("Setnpcstate调用");
public void Setnpcstate()//点击救援按钮执行完动作后对按钮进行隐藏
{
movebool = true;
nstate = Npcstate.healthy;
recusebtn.gameObject.SetActive(false);
Debug.Log("Setnpcstate调用");
}
private void Update()
{
if (Vector3.Distance(transform.position,target.position) < 1.3f && movebool)//判断人物被救援后移动到目标位置
{
Debug.Log("到达目标点");
nstate = Npcstate.idle;
movebool = false;
}
switch (nstate)//通过枚举状态实现人物是否被救援,以及动作的改变
{
case Npcstate.idle:
anim.SetBool("Recuse", false);
break;
case Npcstate.healthy:
anim.SetBool("Recuse", true);
transform.LookAt(target);
transform.position = Vector3.Lerp(transform.position, target.position, 0.3f * Time.deltaTime);
break;
case Npcstate.dead:
break;
}
}
}