Commit 5df3f12e authored by czy's avatar czy

镜头优化和攻击

parent 11fd03c6
......@@ -229,6 +229,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: Grounded
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
......
......@@ -161,11 +161,11 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 27030757}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.000000045737, y: 1.35, z: 1.26}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 1.3499999, z: 1.26}
m_LocalScale: {x: 1.8837, y: 1.84, z: 1.9631765}
m_Children: []
m_Father: {fileID: 883198006}
m_Father: {fileID: 287314580}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &27030759
......@@ -243,6 +243,7 @@ MonoBehaviour:
animator: {fileID: 999493060}
OtherTag: Competitor
targetWall: {fileID: 866649273}
isCauseDamage: 0
--- !u!4 &30458481 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448836596769451, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -267,76 +268,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &44004332
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 44004334}
- component: {fileID: 44004333}
m_Layer: 0
m_Name: CM vcam1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &44004333
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 44004332}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ExcludedPropertiesInInspector:
- m_Script
m_LockStageInInspector:
m_StreamingVersion: 20170927
m_Priority: 10
m_StandbyUpdate: 2
m_LookAt: {fileID: 0}
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
LensShift: {x: 0, y: 0}
GateFit: 2
m_SensorSize: {x: 0.5625, y: 1}
m_Transitions:
m_BlendHint: 0
m_InheritPosition: 0
m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 730247498}
--- !u!4 &44004334
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 44004332}
m_LocalRotation: {x: 0.28169474, y: -0.08886128, z: 0.026210684, w: 0.95502084}
m_LocalPosition: {x: 0, y: 0, z: -13.099998}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 730247498}
m_Father: {fileID: 347934362}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &59922325 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448837826444467, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -597,6 +528,7 @@ MonoBehaviour:
animator: {fileID: 1276349154}
OtherTag: Player
targetWall: {fileID: 916250627}
isCauseDamage: 0
--- !u!65 &186710582
BoxCollider:
m_ObjectHideFlags: 0
......@@ -669,6 +601,76 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &231588919
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 231588921}
- component: {fileID: 231588920}
m_Layer: 0
m_Name: CM vcam1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &231588920
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 231588919}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ExcludedPropertiesInInspector:
- m_Script
m_LockStageInInspector:
m_StreamingVersion: 20170927
m_Priority: 10
m_StandbyUpdate: 2
m_LookAt: {fileID: 0}
m_Follow: {fileID: 883198006}
m_Lens:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
LensShift: {x: 0, y: 0}
GateFit: 2
m_SensorSize: {x: 0.5625, y: 1}
m_Transitions:
m_BlendHint: 0
m_InheritPosition: 0
m_OnCameraLive:
m_PersistentCalls:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1129599700}
--- !u!4 &231588921
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 231588919}
m_LocalRotation: {x: 0.37181228, y: -0.002512246, z: 0.001006226, w: 0.928304}
m_LocalPosition: {x: 0, y: -0.7402992, z: -5.759613}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1129599700}
m_Father: {fileID: 347934362}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 35.788002, y: 0, z: 0}
--- !u!4 &235713556 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448836702107850, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -693,6 +695,38 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &287314579
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 287314580}
m_Layer: 0
m_Name: Model
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &287314580
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 287314579}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 999493059}
- {fileID: 27030758}
m_Father: {fileID: 883198006}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &289469302 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448836110276989, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -1060,11 +1094,11 @@ MonoBehaviour:
m_StreamingVersion: 20170927
m_Priority: 10
m_StandbyUpdate: 2
m_LookAt: {fileID: 883198006}
m_LookAt: {fileID: 0}
m_Follow: {fileID: 883198006}
m_ShowDebugText: 0
m_ChildCameras:
- {fileID: 44004333}
- {fileID: 231588920}
m_ActivateAfter: 0
m_MinDuration: 0
m_RandomizeChoice: 0
......@@ -1086,11 +1120,10 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 347934360}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.5559893, y: 17.040298, z: -11.170387}
m_LocalPosition: {x: 0, y: 17.040298, z: -11.170387}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 481593205}
- {fileID: 44004334}
- {fileID: 231588921}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -1260,60 +1293,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &481593203
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 481593205}
- component: {fileID: 481593204}
m_Layer: 0
m_Name: DollyTrack1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &481593204
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 481593203}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a200b19ca1a9685429ed7e043c28e904, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Resolution: 20
m_Appearance:
pathColor: {r: 0, g: 1, b: 0, a: 1}
inactivePathColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
width: 0.2
m_Looped: 0
m_Waypoints:
- position: {x: 0, y: 0, z: -32.987347}
roll: 0
- position: {x: 0, y: 0, z: 197.62848}
roll: 0
--- !u!4 &481593205
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 481593203}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 3.8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 347934362}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &482084937 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448836964453913, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -1661,7 +1640,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 22604520b1ef064468a7f5f682fe242b, type: 3}
m_Name:
m_EditorClassIdentifier:
VSpeed: 10
VSpeed: 7
power: 1
MoveSpeed: 0
targetWall: {fileID: 916250627}
......@@ -1751,106 +1730,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &730247497
GameObject:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 730247498}
- component: {fileID: 730247501}
- component: {fileID: 730247500}
- component: {fileID: 730247499}
m_Layer: 0
m_Name: cm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &730247498
Transform:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730247497}
m_LocalRotation: {x: 0.34796715, y: 0.04450118, z: -0.016295519, w: -0.9363082}
m_LocalPosition: {x: -5.6008205, y: -5.922329, z: 54.28504}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 44004334}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &730247499
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730247497}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 418e42c7d0405cc48a7b83f63ea53bb3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Path: {fileID: 481593204}
m_PathPosition: 0.17500152
m_PositionUnits: 0
m_PathOffset: {x: 0, y: 0, z: -24.270384}
m_XDamping: 0
m_YDamping: 0
m_ZDamping: 1
m_CameraUp: 0
m_PitchDamping: 0
m_YawDamping: 0
m_RollDamping: 0
m_AutoDolly:
m_Enabled: 1
m_PositionOffset: 0
m_SearchRadius: 2
m_SearchResolution: 5
--- !u!114 &730247500
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730247497}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0
m_HorizontalDamping: 0.5
m_VerticalDamping: 0.5
m_ScreenX: 0.5
m_ScreenY: 0.5020833
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_SoftZoneWidth: 0.34629628
m_SoftZoneHeight: 0.18645835
m_BiasX: 0
m_BiasY: -0.00000031966735
m_CenterOnActivate: 1
--- !u!114 &730247501
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730247497}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &751558661 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448837233425351, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -2153,6 +2032,7 @@ MonoBehaviour:
power: 1
MoveSpeed: 0
targetWall: {fileID: 866649273}
children: {fileID: 287314579}
--- !u!4 &883198006
Transform:
m_ObjectHideFlags: 0
......@@ -2164,8 +2044,7 @@ Transform:
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 999493059}
- {fileID: 27030758}
- {fileID: 287314580}
m_Father: {fileID: 1935587871}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -2524,8 +2403,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1001386389}
m_LocalRotation: {x: 0.28169474, y: -0.08886128, z: 0.026210684, w: 0.95502084}
m_LocalPosition: {x: 4.5559893, y: 17.040298, z: -24.270386}
m_LocalRotation: {x: 0.37181228, y: -0.002512246, z: 0.001006226, w: 0.928304}
m_LocalPosition: {x: 0, y: 16.3, z: -16.93}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -2708,6 +2587,100 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6348171781088263581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1129599699
GameObject:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1129599700}
- component: {fileID: 1129599703}
- component: {fileID: 1129599702}
- component: {fileID: 1129599701}
m_Layer: 0
m_Name: cm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1129599700
Transform:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129599699}
m_LocalRotation: {x: -0.19973253, y: 0.20478079, z: -0.043233, w: 0.95723706}
m_LocalPosition: {x: 4.55578, y: -11.543444, z: 36.159924}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 231588921}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1129599701
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129599699}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 1
m_FollowOffset: {x: 0, y: 15.3, z: -16.93}
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1
m_AngularDampingMode: 0
m_PitchDamping: 0
m_YawDamping: 0
m_RollDamping: 0
m_AngularDamping: 0
--- !u!114 &1129599702
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129599699}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0
m_HorizontalDamping: 0.5
m_VerticalDamping: 0.5
m_ScreenX: 0.5083332
m_ScreenY: 0.47656247
m_DeadZoneWidth: 0
m_DeadZoneHeight: 0
m_SoftZoneWidth: 0.5222217
m_SoftZoneHeight: 0.4031247
m_BiasX: 0
m_BiasY: -0.0000001478566
m_CenterOnActivate: 1
--- !u!114 &1129599703
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129599699}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1129955889 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5957448837378180208, guid: 15d49ef1e12d35a46b7c6fb953021b43,
......@@ -3457,7 +3430,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 22604520b1ef064468a7f5f682fe242b, type: 3}
m_Name:
m_EditorClassIdentifier:
VSpeed: 9
VSpeed: 6.5
power: 1
MoveSpeed: 0
targetWall: {fileID: 952561886}
......@@ -3649,6 +3622,7 @@ MonoBehaviour:
animator: {fileID: 873361219}
OtherTag: Player
targetWall: {fileID: 952561886}
isCauseDamage: 0
--- !u!65 &1414299318
BoxCollider:
m_ObjectHideFlags: 0
......@@ -5364,7 +5338,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 883198006}
m_TransformParent: {fileID: 287314580}
m_Modifications:
- target: {fileID: -4216859302048453862, guid: c219f3651d3c9d94bbb025aba0f6cd5e,
type: 3}
......
......@@ -78,6 +78,7 @@ public class AIMove : MonoBehaviour
Destroy(other.gameObject);
}
}
private void Scale(float x, float y, float z)
{
transform.localScale = new Vector3(x, y, x);
......@@ -98,12 +99,22 @@ public class AIMove : MonoBehaviour
RandomFoodNumberToPush = Random.Range(1,11);
HaveFoodNumber = 0;
//targetObj = GetTargetPos();
//print("改变状态为回到起点2");
aiState = AIState.TurnBackToPathPos0; //到路径起点,准备去找食物
}
Scale(power, power, power);
}
}
//受到伤害
public void Hurt(float hurt)
{
power -= hurt;
if (power < 1)
{
power = 1;
}
Scale(power, power, power);
}
private void FixedUpdate()
{
......@@ -125,13 +136,13 @@ public class AIMove : MonoBehaviour
}
//------------------------AI的寻路点切换---------------------------------------------------------------
switch (aiState)
{
case AIState.FindFood:
//找食物
if (targetObj == null || targetObj.tag!= "Food")
{
targetObj = GetTargetPos();
//print("获取新目标:"+ targetObj);
}
......@@ -139,7 +150,7 @@ public class AIMove : MonoBehaviour
case AIState.GoToPathPos0:
//去路径起点
targetObj = pathPos0;
if (Vector3.Distance(transform.position, pathPos0.transform.position) < 0.2f)
if (Vector3.Distance(transform.position, pathPos0.transform.position) < 1.2f)
{
aiState = AIState.Push;
}
......@@ -150,6 +161,7 @@ public class AIMove : MonoBehaviour
{
//按路径返回
targetObj = pathPos0;
//print("改变状态为回到起点1");
aiState = AIState.TurnBackToPathPos0;
}
else
......@@ -160,9 +172,12 @@ public class AIMove : MonoBehaviour
case AIState.TurnBackToPathPos0:
//返回路径起点
targetObj = pathPos0;
if (Vector3.Distance(transform.position, pathPos0.transform.position) < 0.2f)
if (Vector3.Distance(transform.position, pathPos0.transform.position) < 1.2f)
{
//print("改变状态为寻找食物。");
aiState = AIState.FindFood;
targetObj = GetTargetPos();
//print("获取新目标:" + targetObj);
}
break;
default:
......@@ -171,7 +186,7 @@ public class AIMove : MonoBehaviour
}
//-------------------------------------------------------------------------------------
//print(aiState+""+targetObj);
//print("aiState:" + aiState+ "-targetObj:" + targetObj+" 距离:"+ Vector3.Distance(transform.position, pathPos0.transform.position));
yDelta = SpeedY * Time.deltaTime;
Vector3 speed=( targetObj.transform.position - transform.position).normalized*VSpeed;
......@@ -180,6 +195,7 @@ public class AIMove : MonoBehaviour
Move();
}
......
......@@ -14,14 +14,16 @@ public class Attack : MonoBehaviour
// Update is called once per frame
void Update()
{
//gameObject.transform.parent.GetComponentInChildren<AttackTrigger>().isCauseDamage = false;
}
public void AttackLeft()
{
//print(gameObject.name+":左手攻击");
gameObject.transform.parent.GetComponentInChildren<AttackTrigger>().isCauseDamage = true ;
}
public void AttackRight()
{
//print(gameObject.name + ":右手攻击");
gameObject.transform.parent.GetComponentInChildren<AttackTrigger>().isCauseDamage = true;
}
}
......@@ -7,7 +7,8 @@ public class AttackTrigger : MonoBehaviour
public Animator animator;
public string OtherTag= "Competitor";
public GameObject targetWall;
//伤害帧
public bool isCauseDamage=false;
void Start()
{
......@@ -16,7 +17,7 @@ public class AttackTrigger : MonoBehaviour
// Update is called once per frame
void Update()
{
isCauseDamage = false;//由帧事件改变该值
}
private void OnTriggerEnter(Collider other)
{
......@@ -31,6 +32,21 @@ public class AttackTrigger : MonoBehaviour
}
}
private void OnTriggerStay(Collider other)
{
if (other.tag == OtherTag&&isCauseDamage)
{
//print(other.name+"受到伤害:");
if (other.tag == "Player")
{
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(0.5f);
}
else if (other.tag == "Competitor")
{
other.gameObject.GetComponentInChildren<AIMove>().Hurt(0.5f);
}
}
}
private void OnTriggerExit(Collider other)
{
......
......@@ -20,32 +20,13 @@ public class PlayerMove : MonoBehaviour
public float HSpeed = 10.0f;
[Tooltip("游戏结束每秒减少的速度")]
public float deceleration = 15;
[Header("特效")]
public ParticleSystem particleChange; //变身特效
public float power = 1;
private RaycastHit RHit;
private CharacterController characterController;
private bool m_bIsCanMove = true;//是否能开车
private MeshCollider[] m_targetTrans;//所有目标
private MeshCollider m_curTargetTrans;//当前抓的目标
// private Rigidbody m_rigidBody;//自身刚体
private Dictionary<MeshCollider, bool> m_dicBox = new Dictionary<MeshCollider, bool>();
private bool m_bControlStartMove = false;
private RectTransform m_thumbRT;//摇杆
private Dictionary<Rigidbody, bool> m_dicRigidDic = new Dictionary<Rigidbody, bool>();
private bool isGround1 = true;
private bool isGround2 = true;
private float timer = 0.0f;
//输入控制player移动的中间变量
private float _vertSpeed = 0.0f;
private float xDelta=0.0f;
......@@ -60,30 +41,20 @@ public class PlayerMove : MonoBehaviour
[HideInInspector]
public float MoveSpeed=0.0f;
private bool Grounded = false;
//最大速度等级
private int MaxSpeedLevel = 15;//1-15 分为 1-5 6-10 11-15
public GameObject targetWall;
public GameObject children;
// Start is called before the first frame update
void Start()
{
//从配置文件ConfigurationFile中获取数据
//VSpeed = ConfigurationFile.instance.VSpeed;
SpeedLevel = ConfigurationFile.instance.SpeedLevel;
//AddSpeed = ConfigurationFile.instance.AddSpeed;
//HSpeed = ConfigurationFile.instance.HSpeed;
//摇杆控制
GameServices.inputService.joyStick.onTouchStart.AddListener(OnTouchStart);
GameServices.inputService.joyStick.onTouchUp.AddListener(OnTouchUp);
......@@ -131,6 +102,17 @@ public class PlayerMove : MonoBehaviour
Scale(power, power, power);
}
}
//受到伤害
public void Hurt(float hurt)
{
power -= hurt;
if (power < 1)
{
power = 1;
}
Scale(power, power, power);
}
private void Scale(float x,float y,float z)
{
transform.localScale = new Vector3(x,y,x);
......@@ -256,7 +238,7 @@ public class PlayerMove : MonoBehaviour
}
}
if (m_bIsCanMove && !BattleCtrl.instance.IsScoreSettlementStatus)
if ( !BattleCtrl.instance.IsScoreSettlementStatus)
{
//print("控制摇杆");
if (timerVertigo <= 0)
......@@ -340,7 +322,9 @@ public class PlayerMove : MonoBehaviour
{
angle = -Mathf.Abs(angle);
}
transform.localEulerAngles = new Vector3(0, angle, 0);
//transform.localEulerAngles = new Vector3(0, angle, 0);
children.transform.localEulerAngles = new Vector3(0, angle, 0);
//transform.rotation = Quaternion.Euler(0, angle, 0);//转向
characterController.Move(new Vector3(xDelta, yDelta, zDelta));//移动
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment