mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 18:17:31 -05:00
Archer rotates to target the player. Doesn't shoot yet
This commit is contained in:
parent
d27f8126cb
commit
d3811aa2f2
|
|
@ -243,101 +243,6 @@ MeshRenderer:
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
--- !u!1 &4784627840501882964
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 4784627840501882967}
|
|
||||||
- component: {fileID: 4784627840501882960}
|
|
||||||
- component: {fileID: 4784627840501882961}
|
|
||||||
- component: {fileID: 4784627840501882966}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: pCylinder4
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &4784627840501882967
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4784627840501882964}
|
|
||||||
m_LocalRotation: {x: 0, y: 1, z: -0, w: 0}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: -1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 6313754771726110875}
|
|
||||||
m_RootOrder: 9
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
|
||||||
--- !u!33 &4784627840501882960
|
|
||||||
MeshFilter:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4784627840501882964}
|
|
||||||
m_Mesh: {fileID: 8211372540250625004, guid: c93393c6eb5bb2b489536f1f078c73c0, type: 3}
|
|
||||||
--- !u!23 &4784627840501882961
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4784627840501882964}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 1
|
|
||||||
m_ReceiveShadows: 1
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 2
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 2100000, guid: e3667ab2a72fda74ea7e9509412c5bd0, type: 2}
|
|
||||||
m_StaticBatchInfo:
|
|
||||||
firstSubMesh: 0
|
|
||||||
subMeshCount: 0
|
|
||||||
m_StaticBatchRoot: {fileID: 0}
|
|
||||||
m_ProbeAnchor: {fileID: 0}
|
|
||||||
m_LightProbeVolumeOverride: {fileID: 0}
|
|
||||||
m_ScaleInLightmap: 1
|
|
||||||
m_ReceiveGI: 1
|
|
||||||
m_PreserveUVs: 0
|
|
||||||
m_IgnoreNormalsForChartDetection: 0
|
|
||||||
m_ImportantGI: 0
|
|
||||||
m_StitchLightmapSeams: 1
|
|
||||||
m_SelectedEditorRenderState: 3
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
|
||||||
--- !u!114 &4784627840501882966
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4784627840501882964}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 02284dc7b53e4b840931d425c06be734, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
speed: 35
|
|
||||||
--- !u!1 &4784627841241590484
|
--- !u!1 &4784627841241590484
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -540,6 +445,8 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 6313754771726110875}
|
- component: {fileID: 6313754771726110875}
|
||||||
- component: {fileID: 6689294808140859936}
|
- component: {fileID: 6689294808140859936}
|
||||||
|
- component: {fileID: 8721692118063281005}
|
||||||
|
- component: {fileID: 4856672042659442783}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Archer
|
m_Name: Archer
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -588,9 +495,74 @@ MonoBehaviour:
|
||||||
runnerTag: Player
|
runnerTag: Player
|
||||||
partToRotate: {fileID: 6313754771726110875}
|
partToRotate: {fileID: 6313754771726110875}
|
||||||
rotationSpeed: 10
|
rotationSpeed: 10
|
||||||
ArrowPrefab: {fileID: 0}
|
ArrowPrefab: {fileID: 26604539265034264, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
firePoint: {fileID: 0}
|
firePoint: {fileID: 4784627841241590487}
|
||||||
runners: []
|
runners: []
|
||||||
|
--- !u!114 &8721692118063281005
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6689294808140859937}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
NetworkInstanceId: 0
|
||||||
|
PrefabHash: 13603218863946243128
|
||||||
|
PrefabHashGenerator: Archer
|
||||||
|
AlwaysReplicateAsRoot: 0
|
||||||
|
DontDestroyWithOwner: 0
|
||||||
|
--- !u!114 &4856672042659442783
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6689294808140859937}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
FixedSendsPerSecond: 20
|
||||||
|
AssumeSyncedSends: 1
|
||||||
|
InterpolatePosition: 1
|
||||||
|
SnapDistance: 10
|
||||||
|
InterpolateServer: 1
|
||||||
|
MinMeters: 0.15
|
||||||
|
MinDegrees: 1.5
|
||||||
|
ExtrapolatePosition: 0
|
||||||
|
MaxSendsToExtrapolate: 5
|
||||||
|
Channel:
|
||||||
|
EnableRange: 0
|
||||||
|
EnableNonProvokedResendChecks: 0
|
||||||
|
DistanceSendrate:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 20
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 500
|
||||||
|
value: 20
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
--- !u!1 &7232804557796252435
|
--- !u!1 &7232804557796252435
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -834,3 +806,65 @@ MeshRenderer:
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!1001 &4771824508636039244
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 6313754771726110875}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 26604539265034264, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Arrow
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 9
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 180
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
--- !u!4 &4784627840501882967 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 26604539265034267, guid: 0e61ec06fdabb014bb1868596534f8b7, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 4771824508636039244}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
|
|
||||||
97
Assets/Prefabs/Environment/Archer/Arrow.prefab
Normal file
97
Assets/Prefabs/Environment/Archer/Arrow.prefab
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &26604539265034264
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 26604539265034267}
|
||||||
|
- component: {fileID: 26604539265034268}
|
||||||
|
- component: {fileID: 26604539265034269}
|
||||||
|
- component: {fileID: 26604539265034266}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Arrow
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &26604539265034267
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 26604539265034264}
|
||||||
|
m_LocalRotation: {x: 0, y: 1, z: -0, w: 0}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: -1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
||||||
|
--- !u!33 &26604539265034268
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 26604539265034264}
|
||||||
|
m_Mesh: {fileID: 8211372540250625004, guid: c93393c6eb5bb2b489536f1f078c73c0, type: 3}
|
||||||
|
--- !u!23 &26604539265034269
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 26604539265034264}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: e3667ab2a72fda74ea7e9509412c5bd0, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!114 &26604539265034266
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 26604539265034264}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 02284dc7b53e4b840931d425c06be734, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
speed: 35
|
||||||
7
Assets/Prefabs/Environment/Archer/Arrow.prefab.meta
Normal file
7
Assets/Prefabs/Environment/Archer/Arrow.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0e61ec06fdabb014bb1868596534f8b7
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -26,7 +26,7 @@ GameObject:
|
||||||
- component: {fileID: 4493700469442532605}
|
- component: {fileID: 4493700469442532605}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerModel
|
m_Name: PlayerModel
|
||||||
m_TagString: Untagged
|
m_TagString: ArcherTarget
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,8 @@ MonoBehaviour:
|
||||||
PlayerPrefab: 0
|
PlayerPrefab: 0
|
||||||
- Prefab: {fileID: 1705285893771051652, guid: 3fd15f10e6c1a07419fdd6bf804b6541, type: 3}
|
- Prefab: {fileID: 1705285893771051652, guid: 3fd15f10e6c1a07419fdd6bf804b6541, type: 3}
|
||||||
PlayerPrefab: 0
|
PlayerPrefab: 0
|
||||||
|
- Prefab: {fileID: 6689294808140859937, guid: 96c2075f01b997847922f482f584a6b0, type: 3}
|
||||||
|
PlayerPrefab: 0
|
||||||
PlayerPrefabHash:
|
PlayerPrefabHash:
|
||||||
id: 0
|
id: 0
|
||||||
CreatePlayerPrefab: 0
|
CreatePlayerPrefab: 0
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,42 @@
|
||||||
using System.Diagnostics;
|
using MLAPI;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Archer : MonoBehaviour
|
public class Archer : NetworkBehaviour
|
||||||
{
|
{
|
||||||
//current target ponting at
|
//current target ponting at
|
||||||
private Transform target;
|
private Transform target;
|
||||||
|
|
||||||
[Header("Attributes")]
|
[Header("Attributes")]
|
||||||
//range of turret
|
//range of turret
|
||||||
public float range = 20.0f;
|
[SerializeField]
|
||||||
|
private float range;
|
||||||
|
|
||||||
//how fast and how much time before the next shot
|
//how fast and how much time before the next shot
|
||||||
public float fireRate = 4.0f;
|
public float fireRate = 4.0f;
|
||||||
private float shootingCooldown = 1.0f;
|
private float shootingCooldown = 1.0f;
|
||||||
|
|
||||||
[Header("Unity Setup Fields")]
|
[Header("Unity Setup Fields")]
|
||||||
public string runnerTag = "Player"; //tags the player;
|
|
||||||
|
|
||||||
public Transform partToRotate;
|
|
||||||
public float rotationSpeed = 10f;
|
public float rotationSpeed = 10f;
|
||||||
|
|
||||||
public GameObject ArrowPrefab;
|
public GameObject ArrowPrefab;
|
||||||
public Transform firePoint;
|
public Transform firePoint;
|
||||||
|
|
||||||
[SerializeField] GameObject[] runners;
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start() {
|
||||||
{
|
// Only the host should update targetting
|
||||||
//setting updateTarget to be called 2 times a second
|
if (IsHost) {
|
||||||
|
//setting updateTarget to be called 2 times a second
|
||||||
InvokeRepeating("updateTarget",0f,0.5f);
|
InvokeRepeating("updateTarget",0f,0.5f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTarget()
|
void updateTarget() {
|
||||||
{
|
|
||||||
//cycles through all enemies within range, the closest one, and sets the target at.
|
//cycles through all enemies within range, the closest one, and sets the target at.
|
||||||
//not done every frame
|
//not done every frame
|
||||||
|
|
||||||
runners = GameObject.FindGameObjectsWithTag(runnerTag);
|
GameObject[] runners = GameObject.FindGameObjectsWithTag("ArcherTarget");
|
||||||
|
|
||||||
//temp variable for the shortest distance for an runner
|
//temp variable for the shortest distance for an runner
|
||||||
float shortestDistance = Mathf.Infinity;
|
float shortestDistance = Mathf.Infinity;
|
||||||
|
|
@ -64,7 +60,8 @@ public class Archer : MonoBehaviour
|
||||||
if(nearestRunner != null && shortestDistance <= range)
|
if(nearestRunner != null && shortestDistance <= range)
|
||||||
{
|
{
|
||||||
target = nearestRunner.transform; //adding in the players rotation and momentum.
|
target = nearestRunner.transform; //adding in the players rotation and momentum.
|
||||||
//leads the shots here
|
|
||||||
|
//TODO: leads the shots here
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -73,20 +70,23 @@ public class Archer : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update() {
|
||||||
{
|
|
||||||
if (target == null)
|
// Shooting Checks are done here, so return and do nothing if not host OR no target
|
||||||
{
|
|
||||||
return; //no target, does nothing
|
if (!IsHost || target == null) { return; }
|
||||||
}
|
|
||||||
//b - a
|
//b - a
|
||||||
Vector3 dir = (target.position - transform.position);
|
Vector3 dir = (target.position - transform.position);
|
||||||
Quaternion lookRotation = Quaternion.LookRotation(dir);//how to rotate to look that way.
|
Quaternion lookRotation = Quaternion.LookRotation(dir);//how to rotate to look that way.
|
||||||
//convert into a VEC 3 from Quaternion
|
//convert into a VEC 3 from Quaternion
|
||||||
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime *rotationSpeed).eulerAngles;
|
Vector3 rotation = Quaternion.Lerp(this.gameObject.transform.rotation, lookRotation, Time.deltaTime * rotationSpeed).eulerAngles;
|
||||||
partToRotate.rotation = Quaternion.Euler (0f, rotation.y, 0f);
|
Debug.Log("Look Rot: " + lookRotation + " Rot: " + rotation);
|
||||||
|
this.gameObject.transform.rotation = Quaternion.Euler (0f, rotation.y, 0f);
|
||||||
|
|
||||||
|
// Actually shoot it
|
||||||
|
// TODO: Network this part
|
||||||
|
/*
|
||||||
if (shootingCooldown <= 0f)
|
if (shootingCooldown <= 0f)
|
||||||
{
|
{
|
||||||
Shoot();
|
Shoot();
|
||||||
|
|
@ -94,30 +94,25 @@ public class Archer : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
shootingCooldown -= Time.deltaTime;
|
shootingCooldown -= Time.deltaTime;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Shoot()
|
void Shoot() {
|
||||||
{
|
|
||||||
|
|
||||||
GameObject arrowGO = (GameObject)Instantiate (ArrowPrefab, firePoint.position, firePoint.rotation);
|
GameObject arrowGO = Instantiate(ArrowPrefab, firePoint.position, firePoint.rotation).gameObject;
|
||||||
Arrow arrow = arrowGO.GetComponent<Arrow>();
|
Arrow arrow = arrowGO.GetComponent<Arrow>();
|
||||||
|
|
||||||
if (arrow != null)
|
if (arrow != null) {
|
||||||
{
|
|
||||||
arrow.Seek(target.position);
|
arrow.Seek(target.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OnDrawGizmosSelected()
|
void OnDrawGizmosSelected() {
|
||||||
{
|
Gizmos.color = Color.red;
|
||||||
|
Gizmos.DrawWireSphere(transform.position, range);
|
||||||
Gizmos.color = Color.red;
|
//^ this shows the range of the archer, only in editor.
|
||||||
Gizmos.DrawWireSphere(transform.position, range);
|
|
||||||
//^ this shows the range of the archer, only in editor.
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ TagManager:
|
||||||
- destroyable
|
- destroyable
|
||||||
- RunnerHUD
|
- RunnerHUD
|
||||||
- GroundCheck
|
- GroundCheck
|
||||||
|
- ArcherTarget
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|
@ -46,7 +47,6 @@ TagManager:
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
|
||||||
m_SortingLayers:
|
m_SortingLayers:
|
||||||
- name: UI_Backgrounds
|
- name: UI_Backgrounds
|
||||||
uniqueID: 378093239
|
uniqueID: 378093239
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ EditorUserSettings:
|
||||||
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedScenePath-1:
|
RecentlyUsedScenePath-1:
|
||||||
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedScenePath-2:
|
RecentlyUsedScenePath-2:
|
||||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedScenePath-3:
|
RecentlyUsedScenePath-3:
|
||||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||||
flags: 0
|
flags: 0
|
||||||
vcSharedLogLevel:
|
vcSharedLogLevel:
|
||||||
value: 0d5e400f0650
|
value: 0d5e400f0650
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user