Bullet impact effect
This commit is contained in:
parent
572ff7f8cb
commit
b12816fa80
|
@ -1265,74 +1265,6 @@ Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 400000, guid: 584a8ef4749c89745b7ae07f3ba7617f, type: 3}
|
m_CorrespondingSourceObject: {fileID: 400000, guid: 584a8ef4749c89745b7ae07f3ba7617f, type: 3}
|
||||||
m_PrefabInstance: {fileID: 945433442}
|
m_PrefabInstance: {fileID: 945433442}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &1105115519
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1105115522}
|
|
||||||
- component: {fileID: 1105115521}
|
|
||||||
- component: {fileID: 1105115520}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: EventSystem
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 0
|
|
||||||
--- !u!114 &1105115520
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1105115519}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_SendPointerHoverToParent: 1
|
|
||||||
m_HorizontalAxis: Horizontal
|
|
||||||
m_VerticalAxis: Vertical
|
|
||||||
m_SubmitButton: Submit
|
|
||||||
m_CancelButton: Cancel
|
|
||||||
m_InputActionsPerSecond: 10
|
|
||||||
m_RepeatDelay: 0.5
|
|
||||||
m_ForceModuleActive: 0
|
|
||||||
--- !u!114 &1105115521
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1105115519}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_FirstSelected: {fileID: 0}
|
|
||||||
m_sendNavigationEvents: 1
|
|
||||||
m_DragThreshold: 10
|
|
||||||
--- !u!4 &1105115522
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1105115519}
|
|
||||||
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_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 6
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1001 &1162621910
|
--- !u!1001 &1162621910
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -2552,6 +2484,10 @@ PrefabInstance:
|
||||||
propertyPath: reloadAction.m_Name
|
propertyPath: reloadAction.m_Name
|
||||||
value: Reload
|
value: Reload
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4641286401744272850, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _BulletImpact
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
- target: {fileID: 5428686084875064986, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 5428686084875064986, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: MuzzleFlash
|
value: MuzzleFlash
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8649c30706ffaa4faf98c471bc86ba6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82851982cb47c134a8403ffcb052b9d2
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -6,10 +6,11 @@ using UnityEngine.InputSystem;
|
||||||
|
|
||||||
public class Weapon : MonoBehaviour
|
public class Weapon : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] Camera _FpCamera;
|
[SerializeField] private Camera _FpCamera;
|
||||||
[SerializeField] ParticleSystem _MuzzleFlash;
|
[SerializeField] private ParticleSystem _MuzzleFlash;
|
||||||
[SerializeField] float _range = 100f;
|
[SerializeField] private GameObject _BulletImpact;
|
||||||
[SerializeField] float _weaponDamage = 25f;
|
[SerializeField] private float _range = 100f;
|
||||||
|
[SerializeField] private float _weaponDamage = 25f;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,7 @@ public class Weapon : MonoBehaviour
|
||||||
if (Physics.Raycast(_FpCamera.transform.position, _FpCamera.transform.forward, out RaycastHit hit, _range))
|
if (Physics.Raycast(_FpCamera.transform.position, _FpCamera.transform.forward, out RaycastHit hit, _range))
|
||||||
{
|
{
|
||||||
print($"{hit.transform.name} was hit!");
|
print($"{hit.transform.name} was hit!");
|
||||||
|
ImpactAnimation(hit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -56,4 +58,10 @@ public class Weapon : MonoBehaviour
|
||||||
hit.transform.GetComponent<IDamageable>().ModifyHealth(-_weaponDamage);
|
hit.transform.GetComponent<IDamageable>().ModifyHealth(-_weaponDamage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ImpactAnimation(RaycastHit hit)
|
||||||
|
{
|
||||||
|
GameObject impactEffect = Instantiate(_BulletImpact, hit.point, Quaternion.LookRotation(hit.normal));
|
||||||
|
Destroy(impactEffect, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue