Closes #189 대포 이펙트 변경

+ ParticleWeapon을 통해서, 원하는 레이어에 원하는 파티클이 터지게끔 기능을 변경했습니다.
This commit is contained in:
NTG_Lenovo 2024-02-05 14:30:40 +09:00
parent d71b540f34
commit 2ccf990ab6
7 changed files with 29499 additions and 13 deletions

View File

@ -13019,8 +13019,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1485085414} m_GameObject: {fileID: 1485085414}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.38026586, y: 0.6187088, z: -0.46294132, w: 0.50821525} m_LocalRotation: {x: 0.38026667, y: 0.6187079, z: -0.46294075, w: 0.50821626}
m_LocalPosition: {x: -0.001750946, y: 0, z: -0.008834839} m_LocalPosition: {x: -0.0017852783, y: 0, z: -0.009002686}
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:
@ -17671,6 +17671,8 @@ MonoBehaviour:
autoInit: 0 autoInit: 0
playerInput: {fileID: 975912080} playerInput: {fileID: 975912080}
projectileObject: {fileID: 128572, guid: 8d387b0f65dfa4cdc965c4b56216e120, type: 3} projectileObject: {fileID: 128572, guid: 8d387b0f65dfa4cdc965c4b56216e120, type: 3}
waterExplosionPrefab: {fileID: 5481875147519058070, guid: b247fa420e90f3f4996319f760a3d88b,
type: 3}
visualLook: {fileID: 4143712617986135} visualLook: {fileID: 4143712617986135}
launchTransform: {fileID: 1286537730} launchTransform: {fileID: 1286537730}
predictedLine: {fileID: 1913692422} predictedLine: {fileID: 1913692422}
@ -17688,8 +17690,8 @@ MonoBehaviour:
gaugeChargingTime: 1 gaugeChargingTime: 1
launchCooldown: 1 launchCooldown: 1
distanceCoefficient: 40 distanceCoefficient: 40
launchType: 0 launchType: 1
launchSpeed: 30 launchSpeed: 40
launchAngle: 10 launchAngle: 10
isUsingPredictLine: 1 isUsingPredictLine: 1
lineMaxPoint: 100 lineMaxPoint: 100

View File

@ -3,7 +3,6 @@ using System.Collections;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using UnityEngine.Serialization;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
@ -9,7 +10,15 @@ namespace BlueWaterProject
{ {
public class ParticleWeapon : MonoBehaviour public class ParticleWeapon : MonoBehaviour
{ {
public GameObject impactParticle; // Effect spawned when projectile hits a collider [Serializable]
public class ImpactParticleInfo
{
public GameObject impactParticle;
public LayerMask layer;
}
public List<ImpactParticleInfo> impactParticleInfoList = new();
//public GameObject impactParticle; // Effect spawned when projectile hits a collider
public GameObject projectileParticle; // Effect attached to the gameobject as child public GameObject projectileParticle; // Effect attached to the gameobject as child
public GameObject muzzleParticle; // Effect instantly spawned when gameobject is spawned public GameObject muzzleParticle; // Effect instantly spawned when gameobject is spawned
[Header("Adjust if not using Sphere Collider")] [Header("Adjust if not using Sphere Collider")]
@ -87,7 +96,15 @@ namespace BlueWaterProject
if (Physics.SphereCast(transform.position, radius, direction, out var hit, detectionDistance, targetLayer)) // Checks if collision will happen if (Physics.SphereCast(transform.position, radius, direction, out var hit, detectionDistance, targetLayer)) // Checks if collision will happen
{ {
transform.position = hit.point + (hit.normal * collideOffset); // Move projectile to point of collision transform.position = hit.point + (hit.normal * collideOffset); // Move projectile to point of collision
var impactP = Instantiate(impactParticle, transform.position, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; // Spawns impact effect
GameObject impactP = null;
foreach (var element in impactParticleInfoList)
{
if ((element.layer & (1 << hit.collider.gameObject.layer)) == 0) continue;
impactP = Instantiate(element.impactParticle, transform.position, Quaternion.FromToRotation(Vector3.up, hit.normal));
break;
}
var trails = GetComponentsInChildren<ParticleSystem>(); // Gets a list of particle systems, as we need to detach the trails var trails = GetComponentsInChildren<ParticleSystem>(); // Gets a list of particle systems, as we need to detach the trails
//Component at [0] is that of the parent i.e. this object (if there is any) //Component at [0] is that of the parent i.e. this object (if there is any)
@ -112,7 +129,10 @@ namespace BlueWaterProject
} }
Destroy(projectileParticle, 3f); // Removes particle effect after delay Destroy(projectileParticle, 3f); // Removes particle effect after delay
Destroy(impactP, 3.5f); // Removes impact effect after delay if (impactP)
{
Destroy(impactP, 3.5f); // Removes impact effect after delay
}
Destroy(gameObject); // Removes the projectile Destroy(gameObject); // Removes the projectile
} }
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -2,20 +2,24 @@
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000 --- !u!21 &2100000
Material: Material:
serializedVersion: 6 serializedVersion: 8
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: M_Decals m_Name: M_Decals
m_Shader: {fileID: 4800000, guid: ef0e994b94e5f5e43aeeef2ff22357cc, type: 3} m_Shader: {fileID: 4800000, guid: ef0e994b94e5f5e43aeeef2ff22357cc, type: 3}
m_ShaderKeywords: m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
stringTagMap: {} stringTagMap: {}
disabledShaderPasses: [] disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
@ -55,6 +59,7 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats: m_Floats:
- _BumpScale: 1 - _BumpScale: 1
- _Cutoff: 0.5 - _Cutoff: 0.5
@ -75,3 +80,5 @@ Material:
m_Colors: m_Colors:
- _Color: {r: 0.8867924, g: 0.8867924, b: 0.8867924, a: 1} - _Color: {r: 0.8867924, g: 0.8867924, b: 0.8867924, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1