make working enermy with ai

This commit is contained in:
Sc0rch-thinks 2024-07-02 10:42:09 +08:00
parent 77e4b75e4f
commit 604d592ee8
19 changed files with 2341 additions and 240 deletions

View file

@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 6916749199650078309} - component: {fileID: 6916749199650078309}
- component: {fileID: 2578125575657415053} - component: {fileID: 2578125575657415053}
- component: {fileID: 6778915936728483955} - component: {fileID: 6778915936728483955}
- component: {fileID: 2372079994149255709}
m_Layer: 0 m_Layer: 0
m_Name: Bullet m_Name: Bullet
m_TagString: Untagged m_TagString: Untagged
@ -133,3 +134,17 @@ Rigidbody:
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 0 m_Constraints: 0
m_CollisionDetection: 0 m_CollisionDetection: 0
--- !u!114 &2372079994149255709
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 634305283682154916}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 69125b331043ed74c8631d9a8966bbbb, type: 3}
m_Name:
m_EditorClassIdentifier:
damage: 65
lifespan: 5

File diff suppressed because it is too large Load diff

View file

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

View file

@ -589,7 +589,7 @@ Transform:
m_GameObject: {fileID: 3366665043858970863} m_GameObject: {fileID: 3366665043858970863}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 633.38696, y: 53.228, z: 712.275} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:

View file

@ -377,6 +377,38 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 367155638} m_GameObject: {fileID: 367155638}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &376520021
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 376520022}
m_Layer: 8
m_Name: hand
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &376520022
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 376520021}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.569, y: 0, z: 0.253}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5722651808059730734}
m_Father: {fileID: 7523861224561778816}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &565925926 stripped --- !u!1 &565925926 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 253673096910479318, guid: fcc3124eb1a35354d8faf61ffa67d814, m_CorrespondingSourceObject: {fileID: 253673096910479318, guid: fcc3124eb1a35354d8faf61ffa67d814,
@ -406,7 +438,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!4 &870943463 --- !u!4 &870943463
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -430,7 +462,7 @@ VFXRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 870943462} m_GameObject: {fileID: 870943462}
m_Enabled: 1 m_Enabled: 0
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
@ -623,7 +655,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1084962702} - component: {fileID: 1084962702}
m_Layer: 8 m_Layer: 7
m_Name: hand position m_Name: hand position
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -760,6 +792,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
playerCamera: {fileID: 781711374} playerCamera: {fileID: 781711374}
seeDistance: 5 seeDistance: 5
CurrentGun: {fileID: 0}
holdingGun: {fileID: 0}
hand: {fileID: 1084962701} hand: {fileID: 1084962701}
--- !u!4 &1312533610 stripped --- !u!4 &1312533610 stripped
Transform: Transform:
@ -812,6 +846,21 @@ PrefabInstance:
propertyPath: SprintSpeed propertyPath: SprintSpeed
value: 20 value: 20
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 453084650579209855, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2351121289802177058, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2862278905431641492, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2862278905431641495, guid: 035bf1ba97d19214580cfe6f5a29fdc3, - target: {fileID: 2862278905431641495, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3} type: 3}
propertyPath: CameraDistance propertyPath: CameraDistance
@ -827,6 +876,16 @@ PrefabInstance:
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2862278905927073192, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4253012990419024489, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4253012990419024491, guid: 035bf1ba97d19214580cfe6f5a29fdc3, - target: {fileID: 4253012990419024491, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3} type: 3}
propertyPath: m_Enabled propertyPath: m_Enabled
@ -867,6 +926,11 @@ PrefabInstance:
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5126527961139664765, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5126527961139664767, guid: 035bf1ba97d19214580cfe6f5a29fdc3, - target: {fileID: 5126527961139664767, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3} type: 3}
propertyPath: field of view propertyPath: field of view
@ -892,6 +956,11 @@ PrefabInstance:
propertyPath: m_BackGroundColor.r propertyPath: m_BackGroundColor.r
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5242107653240477476, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 6556307555316582679, guid: 035bf1ba97d19214580cfe6f5a29fdc3, - target: {fileID: 6556307555316582679, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -947,6 +1016,11 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: NestedParent_Unpack value: NestedParent_Unpack
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7094977340588366727, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3}
propertyPath: m_Layer
value: 7
objectReference: {fileID: 0}
- target: {fileID: 7094977340588366727, guid: 035bf1ba97d19214580cfe6f5a29fdc3, - target: {fileID: 7094977340588366727, guid: 035bf1ba97d19214580cfe6f5a29fdc3,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
@ -974,6 +1048,69 @@ PrefabInstance:
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1312533616} addedObject: {fileID: 1312533616}
m_SourcePrefab: {fileID: 100100000, guid: 035bf1ba97d19214580cfe6f5a29fdc3, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 035bf1ba97d19214580cfe6f5a29fdc3, type: 3}
--- !u!1 &1560936834
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1560936836}
- component: {fileID: 1560936835}
m_Layer: 0
m_Name: navMesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1560936835
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1560936834}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a5ac11cc976e418e8d13136b07e1f52, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AgentTypeID: 0
m_CollectObjects: 0
m_Size: {x: 10, y: 10, z: 10}
m_Center: {x: 0, y: 2, z: 0}
m_LayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_UseGeometry: 0
m_DefaultArea: 0
m_GenerateLinks: 1
m_IgnoreNavMeshAgent: 1
m_IgnoreNavMeshObstacle: 1
m_OverrideTileSize: 0
m_TileSize: 256
m_OverrideVoxelSize: 0
m_VoxelSize: 0.16666667
m_MinRegionArea: 2
m_NavMeshData: {fileID: 23800000, guid: 9ce6c8e041f4a72418bd35bc47b82f64, type: 2}
m_BuildHeightMesh: 0
--- !u!4 &1560936836
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1560936834}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 632.8, y: 53.06, z: 707.66}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1880143511 --- !u!1 &1880143511
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -985,7 +1122,7 @@ GameObject:
- component: {fileID: 1880143514} - component: {fileID: 1880143514}
- component: {fileID: 1880143513} - component: {fileID: 1880143513}
- component: {fileID: 1880143512} - component: {fileID: 1880143512}
m_Layer: 0 m_Layer: 8
m_Name: Terrain m_Name: Terrain
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -1066,6 +1203,43 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1888931747
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1888931748}
m_Layer: 8
m_Name: refrence
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1888931748
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1888931747}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.373, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7523861224561778816}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4909242260980625812 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7938632458746094310, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
m_PrefabInstance: {fileID: 7852504279946953677}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5691261327966626505 --- !u!1001 &5691261327966626505
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1134,6 +1308,12 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5fb943f0c37a29e4ab9d29553d613711, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 5fb943f0c37a29e4ab9d29553d613711, type: 3}
--- !u!4 &5722651808059730734 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
m_PrefabInstance: {fileID: 7852504279946953677}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &6704506024639312884 --- !u!1001 &6704506024639312884
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1185,7 +1365,7 @@ PrefabInstance:
- target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 1 value: 0.77285933
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
@ -1200,7 +1380,7 @@ PrefabInstance:
- target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0 value: 0.63457745
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
@ -1215,7 +1395,7 @@ PrefabInstance:
- target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 2734560914043830869, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 78.777
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3366665043858970863, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 3366665043858970863, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
@ -1227,6 +1407,16 @@ PrefabInstance:
propertyPath: mag propertyPath: mag
value: value:
objectReference: {fileID: 565925926} objectReference: {fileID: 565925926}
- target: {fileID: 8616388319935238913, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3}
propertyPath: fire
value:
objectReference: {fileID: 870943465}
- target: {fileID: 8616388319935238913, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3}
propertyPath: range
value: 120
objectReference: {fileID: 0}
- target: {fileID: 8616388319935238913, guid: fcc3124eb1a35354d8faf61ffa67d814, - target: {fileID: 8616388319935238913, guid: fcc3124eb1a35354d8faf61ffa67d814,
type: 3} type: 3}
propertyPath: fpsCam propertyPath: fpsCam
@ -1257,6 +1447,243 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 6704506024639312884} m_PrefabInstance: {fileID: 6704506024639312884}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &7523861224561778816
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 567.83887, y: 53.005142, z: 599.395}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 376520022}
- {fileID: 1888931748}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &7523861224561778817
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &7523861224561778819
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7523861224561778816}
- component: {fileID: 7523861224561778831}
- component: {fileID: 7523861224561778830}
- component: {fileID: 7523861224561778817}
- component: {fileID: 7523861224561778833}
- component: {fileID: 7523861224561778834}
m_Layer: 8
m_Name: Capsule
m_TagString: enemy
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &7523861224561778830
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
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: 6b911390c5825014e8377183a7837d3f, 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!33 &7523861224561778831
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &7523861224561778833
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c199db931449c5a43aeac4001b086a95, type: 3}
m_Name:
m_EditorClassIdentifier:
agent: {fileID: 7523861224561778834}
player: {fileID: 1312533610}
groundMask:
serializedVersion: 2
m_Bits: 256
playerMask:
serializedVersion: 2
m_Bits: 128
health: 100
WalkPoint: {x: 0, y: 0, z: 0}
walkRange: 25
sightRange: 25
attackRange: 15
gun: {fileID: 4909242260980625812}
--- !u!195 &7523861224561778834
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7523861224561778819}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 2
m_BaseOffset: 1
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!1001 &7852504279946953677
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 376520022}
m_Modifications:
- target: {fileID: 3270813210746987743, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_IsKinematic
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4049575175909728394, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6064497003828031006, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: fpsCam
value:
objectReference: {fileID: 1888931748}
- target: {fileID: 7938632458746094310, guid: 0cb9e1bb0725a89488a294c55923e082,
type: 3}
propertyPath: m_Name
value: enemyGun
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0cb9e1bb0725a89488a294c55923e082, type: 3}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1268,3 +1695,5 @@ SceneRoots:
- {fileID: 6704506024639312884} - {fileID: 6704506024639312884}
- {fileID: 1326803979} - {fileID: 1326803979}
- {fileID: 5691261327966626505} - {fileID: 5691261327966626505}
- {fileID: 7523861224561778816}
- {fileID: 1560936836}

Binary file not shown.

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9ce6c8e041f4a72418bd35bc47b82f64
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 23800000
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Scripts/Bullet.cs Normal file
View file

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class BulletCollider : MonoBehaviour
{
public int damage;
public float lifespan;
void OnCollisionEnter(Collision other)
{
Debug.Log("nf");
if (other.transform.tag == "Player")
{
GameManager.instance.damagePlayer(damage);
}
else if(other.transform.tag=="enemy")
{
other.transform.GetComponent<EnemyAi>().health-=damage;
if(other.transform.GetComponent<EnemyAi>().health<=0)
{
Destroy(other.gameObject);
}
}
}
void Update()
{
lifespan-=Time.deltaTime;
if(lifespan<=0)
{
killBullet();
}
}
public void killBullet()
{
Destroy(gameObject);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 69125b331043ed74c8631d9a8966bbbb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -13,7 +13,8 @@ public class CharacterControl : MonoBehaviour
float seeDistance; float seeDistance;
Interactable curretInteractable; Interactable curretInteractable;
Pickable currentPickable; Pickable currentPickable;
Gun CurrentGun=null; public GunPickable CurrentGun;
public GameObject holdingGun;
public RaycastHit hitInfo; public RaycastHit hitInfo;
public static bool handsFull; public static bool handsFull;
@ -37,10 +38,7 @@ void Update()
{ {
Debug.Log(hitInfo.transform.name); Debug.Log(hitInfo.transform.name);
if (hitInfo.transform.TryGetComponent<Interactable>(out curretInteractable)) { } if (hitInfo.transform.TryGetComponent<Interactable>(out curretInteractable)) { }
else if (hitInfo.transform.TryGetComponent<Pickable>(out currentPickable)) else if (hitInfo.transform.TryGetComponent<Pickable>(out currentPickable)) { }
{
if (hitInfo.transform.TryGetComponent<Gun>(out CurrentGun)) { }
}
else else
{ {
curretInteractable = null; curretInteractable = null;
@ -63,6 +61,10 @@ void OnInteract()
if (currentPickable != null) if (currentPickable != null)
{ {
currentPickable.PickUp(); currentPickable.PickUp();
if (currentPickable.TryGetComponent<GunPickable>(out CurrentGun))
{
holdingGun = CurrentGun.gameObject;
}
} }
} }
@ -71,8 +73,7 @@ void OnShoot()
Debug.Log("Shoot"); Debug.Log("Shoot");
if (CurrentGun != null) if (CurrentGun != null)
{ {
CurrentGun.GetComponent<Gun>().Shoot();
CurrentGun.Shoot();
} }
} }
@ -80,7 +81,7 @@ void OnReload()
{ {
if (CurrentGun != null) if (CurrentGun != null)
{ {
CurrentGun.Reload(); CurrentGun.GetComponent<Gun>().Reload();
} }
} }

107
Assets/Scripts/EnemyAi.cs Normal file
View file

@ -0,0 +1,107 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
public class EnemyAi : MonoBehaviour
{
public NavMeshAgent agent;
public Transform player;
public LayerMask groundMask;
public LayerMask playerMask;
public int health = 100;
/// <summary>
/// patrol variables
/// </summary>
public Vector3 WalkPoint;
private bool walkPointSet = false;
public float walkRange;
public float sightRange;
public float attackRange;
private bool playerInSightRange;
private bool playerInAttackRange;
public GameObject gun;
void Update()
{
//Check for sight and attack range
playerInSightRange = Physics.CheckSphere(transform.position, sightRange, playerMask);
playerInAttackRange = Physics.CheckSphere(transform.position, attackRange, playerMask);
if (!playerInSightRange && !playerInAttackRange)
Patrol();
if (playerInSightRange && !playerInAttackRange)
Chase();
if (playerInAttackRange && playerInSightRange)
Attack();
if (health <= 0)
{
Destroy(gameObject);
}
}
private void Patrol()
{
Debug.Log("Patroling");
if (!walkPointSet)
{
SeachWalkPoint();
}
else
{
agent.SetDestination(WalkPoint);
}
;
Vector3 distaceToWalk = transform.position - WalkPoint;
if (distaceToWalk.magnitude < 1f)
walkPointSet = false;
}
private void SeachWalkPoint()
{
float randomZ = Random.Range(-walkRange, walkRange);
float randomX = Random.Range(-walkRange, walkRange);
WalkPoint = new Vector3(
transform.position.x + randomX,
transform.position.y,
transform.position.z + randomZ
);
if (Physics.Raycast(WalkPoint, -transform.up, 2f, groundMask))
{
walkPointSet = true;
}
}
private void Chase()
{
Debug.Log("chasing");
agent.SetDestination(player.position);
}
private void Attack()
{
Debug.Log("Attacking");
agent.SetDestination(transform.position);
transform.LookAt(player);
gun.GetComponent<enemyGun>().Shoot();
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, attackRange);
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(transform.position, sightRange);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c199db931449c5a43aeac4001b086a95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -19,4 +19,8 @@ void Awake()
} }
} }
public int playerHealth = 100; public int playerHealth = 100;
public void damagePlayer(int damage)
{
playerHealth-=damage;
}
} }

View file

@ -53,9 +53,13 @@ public void Shoot()
RaycastHit hit; RaycastHit hit;
Vector3 targetPoint; Vector3 targetPoint;
if (Physics.Raycast(ray, out hit)) if (Physics.Raycast(ray, out hit))
{targetPoint = hit.point;} {
targetPoint = hit.point;
}
else else
{targetPoint = ray.GetPoint(150);} {
targetPoint = ray.GetPoint(150);
}
Vector3 direction = targetPoint - bulletSpawn.position; Vector3 direction = targetPoint - bulletSpawn.position;
GameObject currentBullet = Instantiate( GameObject currentBullet = Instantiate(
@ -63,6 +67,7 @@ public void Shoot()
bulletSpawn.position, bulletSpawn.position,
Quaternion.identity Quaternion.identity
); );
currentBullet.GetComponent<BulletCollider>().damage = damage;
currentBullet.transform.forward = direction.normalized; currentBullet.transform.forward = direction.normalized;
currentBullet currentBullet
.GetComponent<Rigidbody>() .GetComponent<Rigidbody>()
@ -78,11 +83,12 @@ public void Shoot()
void Update() void Update()
{ {
if(bulletsLeft == 0) if (bulletsLeft == 0)
{ {
Reload(); Reload();
} }
} }
private void ResetShot() private void ResetShot()
{ {
//Allow shooting and invoking again //Allow shooting and invoking again

106
Assets/Scripts/enemyGun.cs Normal file
View file

@ -0,0 +1,106 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class enemyGun : MonoBehaviour
{
public GameObject bullet;
/// <summary>
/// gun stats
/// </summary>
public int magSize;
public int damage;
public float timeBtwShots;
public float range;
public float reloadTime;
public int bulletsPerFire;
public bool automaticFire;
/// <summary>
/// gun status
/// </summary>
private bool reloading;
private bool shooting;
private bool readyToShot;
private int bulletsLeft;
/// <summary>
/// Refrencing
/// </summary>
[SerializeField]
Transform fpsCam;
public Transform bulletSpawn;
public bool allowInvoke = true;
[SerializeField]
private GameObject mag;
void Awake()
{
bulletsLeft = magSize;
readyToShot = true;
}
public void Shoot()
{
if (readyToShot && !reloading && bulletsLeft > 0)
{
Debug.Log("Bang");
readyToShot=false;
GameObject currentBullet = Instantiate(
bullet,
bulletSpawn.position,
Quaternion.identity
);
currentBullet.GetComponent<BulletCollider>().damage=damage;
currentBullet
.GetComponent<Rigidbody>()
.AddForce(transform.forward * range, ForceMode.Impulse);
bulletsLeft--;
if (allowInvoke)
{
Invoke("ResetShot", timeBtwShots);
allowInvoke = false;
}
}
}
void Update()
{
if(bulletsLeft == 0)
{
Reload();
}
}
private void ResetShot()
{
//Allow shooting and invoking again
readyToShot = true;
allowInvoke = true;
}
public void Reload()
{
if (bulletsLeft < magSize && !reloading)
{
Debug.Log("reload");
reloading = true;
readyToShot = false;
Invoke("Reloaded", reloadTime);
mag.SetActive(false);
}
}
void Reloaded()
{
reloading = false;
readyToShot = true;
bulletsLeft = magSize;
mag.SetActive(true);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 18624a89c27eb0148ada0783bcd1a5ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -14,40 +14,60 @@ public class FirstPersonController : MonoBehaviour
[Header("Player")] [Header("Player")]
[Tooltip("Move speed of the character in m/s")] [Tooltip("Move speed of the character in m/s")]
public float MoveSpeed = 4.0f; public float MoveSpeed = 4.0f;
[Tooltip("Sprint speed of the character in m/s")] [Tooltip("Sprint speed of the character in m/s")]
public float SprintSpeed = 6.0f; public float SprintSpeed = 6.0f;
[Tooltip("Rotation speed of the character")] [Tooltip("Rotation speed of the character")]
public float RotationSpeed = 1.0f; public float RotationSpeed = 1.0f;
[Tooltip("Acceleration and deceleration")] [Tooltip("Acceleration and deceleration")]
public float SpeedChangeRate = 10.0f; public float SpeedChangeRate = 10.0f;
[Space(10)] [Space(10)]
[Tooltip("The height the player can jump")] [Tooltip("The height the player can jump")]
public float JumpHeight = 1.2f; public float JumpHeight = 1.2f;
[Tooltip("The character uses its own gravity value. The engine default is -9.81f")] [Tooltip("The character uses its own gravity value. The engine default is -9.81f")]
public float Gravity = -15.0f; public float Gravity = -15.0f;
[Space(10)] [Space(10)]
[Tooltip("Time required to pass before being able to jump again. Set to 0f to instantly jump again")] [Tooltip(
"Time required to pass before being able to jump again. Set to 0f to instantly jump again"
)]
public float JumpTimeout = 0.1f; public float JumpTimeout = 0.1f;
[Tooltip("Time required to pass before entering the fall state. Useful for walking down stairs")]
[Tooltip(
"Time required to pass before entering the fall state. Useful for walking down stairs"
)]
public float FallTimeout = 0.15f; public float FallTimeout = 0.15f;
[Header("Player Grounded")] [Header("Player Grounded")]
[Tooltip("If the character is grounded or not. Not part of the CharacterController built in grounded check")] [Tooltip(
"If the character is grounded or not. Not part of the CharacterController built in grounded check"
)]
public bool Grounded = true; public bool Grounded = true;
[Tooltip("Useful for rough ground")] [Tooltip("Useful for rough ground")]
public float GroundedOffset = -0.14f; public float GroundedOffset = -0.14f;
[Tooltip("The radius of the grounded check. Should match the radius of the CharacterController")]
[Tooltip(
"The radius of the grounded check. Should match the radius of the CharacterController"
)]
public float GroundedRadius = 0.5f; public float GroundedRadius = 0.5f;
[Tooltip("What layers the character uses as ground")] [Tooltip("What layers the character uses as ground")]
public LayerMask GroundLayers; public LayerMask GroundLayers;
[Header("Cinemachine")] [Header("Cinemachine")]
[Tooltip("The follow target set in the Cinemachine Virtual Camera that the camera will follow")] [Tooltip(
"The follow target set in the Cinemachine Virtual Camera that the camera will follow"
)]
public GameObject CinemachineCameraTarget; public GameObject CinemachineCameraTarget;
[Tooltip("How far in degrees can you move the camera up")] [Tooltip("How far in degrees can you move the camera up")]
public float TopClamp = 90.0f; public float TopClamp = 90.0f;
[Tooltip("How far in degrees can you move the camera down")] [Tooltip("How far in degrees can you move the camera down")]
public float BottomClamp = -90.0f; public float BottomClamp = -90.0f;
@ -64,7 +84,6 @@ public class FirstPersonController : MonoBehaviour
private float _jumpTimeoutDelta; private float _jumpTimeoutDelta;
private float _fallTimeoutDelta; private float _fallTimeoutDelta;
#if ENABLE_INPUT_SYSTEM #if ENABLE_INPUT_SYSTEM
private PlayerInput _playerInput; private PlayerInput _playerInput;
#endif #endif
@ -78,11 +97,11 @@ private bool IsCurrentDeviceMouse
{ {
get get
{ {
#if ENABLE_INPUT_SYSTEM #if ENABLE_INPUT_SYSTEM
return _playerInput.currentControlScheme == "KeyboardMouse"; return _playerInput.currentControlScheme == "KeyboardMouse";
#else #else
return false; return false;
#endif #endif
} }
} }
@ -102,7 +121,9 @@ private void Start()
#if ENABLE_INPUT_SYSTEM #if ENABLE_INPUT_SYSTEM
_playerInput = GetComponent<PlayerInput>(); _playerInput = GetComponent<PlayerInput>();
#else #else
Debug.LogError( "Starter Assets package is missing dependencies. Please use Tools/Starter Assets/Reinstall Dependencies to fix it"); Debug.LogError(
"Starter Assets package is missing dependencies. Please use Tools/Starter Assets/Reinstall Dependencies to fix it"
);
#endif #endif
// reset our timeouts on start // reset our timeouts on start
@ -125,8 +146,17 @@ private void LateUpdate()
private void GroundedCheck() private void GroundedCheck()
{ {
// set sphere position, with offset // set sphere position, with offset
Vector3 spherePosition = new Vector3(transform.position.x, transform.position.y - GroundedOffset, transform.position.z); Vector3 spherePosition = new Vector3(
Grounded = Physics.CheckSphere(spherePosition, GroundedRadius, GroundLayers, QueryTriggerInteraction.Ignore); transform.position.x,
transform.position.y - GroundedOffset,
transform.position.z
);
Grounded = Physics.CheckSphere(
spherePosition,
GroundedRadius,
GroundLayers,
QueryTriggerInteraction.Ignore
);
} }
private void CameraRotation() private void CameraRotation()
@ -141,10 +171,18 @@ private void CameraRotation()
_rotationVelocity = _input.look.x * RotationSpeed * deltaTimeMultiplier; _rotationVelocity = _input.look.x * RotationSpeed * deltaTimeMultiplier;
// clamp our pitch rotation // clamp our pitch rotation
_cinemachineTargetPitch = ClampAngle(_cinemachineTargetPitch, BottomClamp, TopClamp); _cinemachineTargetPitch = ClampAngle(
_cinemachineTargetPitch,
BottomClamp,
TopClamp
);
// Update Cinemachine camera target pitch // Update Cinemachine camera target pitch
CinemachineCameraTarget.transform.localRotation = Quaternion.Euler(_cinemachineTargetPitch, 0.0f, 0.0f); CinemachineCameraTarget.transform.localRotation = Quaternion.Euler(
_cinemachineTargetPitch,
0.0f,
0.0f
);
// rotate the player left and right // rotate the player left and right
transform.Rotate(Vector3.up * _rotationVelocity); transform.Rotate(Vector3.up * _rotationVelocity);
@ -160,20 +198,32 @@ private void Move()
// note: Vector2's == operator uses approximation so is not floating point error prone, and is cheaper than magnitude // note: Vector2's == operator uses approximation so is not floating point error prone, and is cheaper than magnitude
// if there is no input, set the target speed to 0 // if there is no input, set the target speed to 0
if (_input.move == Vector2.zero) targetSpeed = 0.0f; if (_input.move == Vector2.zero)
targetSpeed = 0.0f;
// a reference to the players current horizontal velocity // a reference to the players current horizontal velocity
float currentHorizontalSpeed = new Vector3(_controller.velocity.x, 0.0f, _controller.velocity.z).magnitude; float currentHorizontalSpeed = new Vector3(
_controller.velocity.x,
0.0f,
_controller.velocity.z
).magnitude;
float speedOffset = 0.1f; float speedOffset = 0.1f;
float inputMagnitude = _input.analogMovement ? _input.move.magnitude : 1f; float inputMagnitude = _input.analogMovement ? _input.move.magnitude : 1f;
// accelerate or decelerate to target speed // accelerate or decelerate to target speed
if (currentHorizontalSpeed < targetSpeed - speedOffset || currentHorizontalSpeed > targetSpeed + speedOffset) if (
currentHorizontalSpeed < targetSpeed - speedOffset
|| currentHorizontalSpeed > targetSpeed + speedOffset
)
{ {
// creates curved result rather than a linear one giving a more organic speed change // creates curved result rather than a linear one giving a more organic speed change
// note T in Lerp is clamped, so we don't need to clamp our speed // note T in Lerp is clamped, so we don't need to clamp our speed
_speed = Mathf.Lerp(currentHorizontalSpeed, targetSpeed * inputMagnitude, Time.deltaTime * SpeedChangeRate); _speed = Mathf.Lerp(
currentHorizontalSpeed,
targetSpeed * inputMagnitude,
Time.deltaTime * SpeedChangeRate
);
// round speed to 3 decimal places // round speed to 3 decimal places
_speed = Mathf.Round(_speed * 1000f) / 1000f; _speed = Mathf.Round(_speed * 1000f) / 1000f;
@ -191,11 +241,15 @@ private void Move()
if (_input.move != Vector2.zero) if (_input.move != Vector2.zero)
{ {
// move // move
inputDirection = transform.right * _input.move.x + transform.forward * _input.move.y; inputDirection =
transform.right * _input.move.x + transform.forward * _input.move.y;
} }
// move the player // move the player
_controller.Move(inputDirection.normalized * (_speed * Time.deltaTime) + new Vector3(0.0f, _verticalVelocity, 0.0f) * Time.deltaTime); _controller.Move(
inputDirection.normalized * (_speed * Time.deltaTime)
+ new Vector3(0.0f, _verticalVelocity, 0.0f) * Time.deltaTime
);
} }
private void JumpAndGravity() private void JumpAndGravity()
@ -248,8 +302,10 @@ private void JumpAndGravity()
private static float ClampAngle(float lfAngle, float lfMin, float lfMax) private static float ClampAngle(float lfAngle, float lfMin, float lfMax)
{ {
if (lfAngle < -360f) lfAngle += 360f; if (lfAngle < -360f)
if (lfAngle > 360f) lfAngle -= 360f; lfAngle += 360f;
if (lfAngle > 360f)
lfAngle -= 360f;
return Mathf.Clamp(lfAngle, lfMin, lfMax); return Mathf.Clamp(lfAngle, lfMin, lfMax);
} }
@ -258,11 +314,20 @@ private void OnDrawGizmosSelected()
Color transparentGreen = new Color(0.0f, 1.0f, 0.0f, 0.35f); Color transparentGreen = new Color(0.0f, 1.0f, 0.0f, 0.35f);
Color transparentRed = new Color(1.0f, 0.0f, 0.0f, 0.35f); Color transparentRed = new Color(1.0f, 0.0f, 0.0f, 0.35f);
if (Grounded) Gizmos.color = transparentGreen; if (Grounded)
else Gizmos.color = transparentRed; Gizmos.color = transparentGreen;
else
Gizmos.color = transparentRed;
// when selected, draw a gizmo in the position of, and matching radius of, the grounded collider // when selected, draw a gizmo in the position of, and matching radius of, the grounded collider
Gizmos.DrawSphere(new Vector3(transform.position.x, transform.position.y - GroundedOffset, transform.position.z), GroundedRadius); Gizmos.DrawSphere(
new Vector3(
transform.position.x,
transform.position.y - GroundedOffset,
transform.position.z
),
GroundedRadius
);
} }
} }
} }

View file

@ -71,7 +71,7 @@ NavMeshProjectSettings:
cost: 1 cost: 1
m_LastAgentTypeID: -887442657 m_LastAgentTypeID: -887442657
m_Settings: m_Settings:
- serializedVersion: 2 - serializedVersion: 3
agentTypeID: 0 agentTypeID: 0
agentRadius: 0.5 agentRadius: 0.5
agentHeight: 2 agentHeight: 2
@ -84,7 +84,9 @@ NavMeshProjectSettings:
cellSize: 0.16666667 cellSize: 0.16666667
manualTileSize: 0 manualTileSize: 0
tileSize: 256 tileSize: 256
accuratePlacement: 0 buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug: debug:
m_Flags: 0 m_Flags: 0
m_SettingNames: m_SettingNames:

View file

@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2 serializedVersion: 2
tags: tags:
- CinemachineTarget - CinemachineTarget
- enemy
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
@ -13,8 +14,8 @@ TagManager:
- Water - Water
- UI - UI
- isInteractable - isInteractable
- - player
- - terrain
- -
- -
- -