Merge branch 'develop' of 121.165.94.242:capers/bluewater into develop

This commit is contained in:
hho210 2024-02-05 14:49:09 +09:00
commit 793a40b075
6 changed files with 29490 additions and 11 deletions

View File

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

View File

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

View File

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.Events;
@ -9,7 +10,15 @@ namespace BlueWaterProject
{
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 muzzleParticle; // Effect instantly spawned when gameobject is spawned
[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
{
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
//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(impactP, 3.5f); // Removes impact effect after delay
if (impactP)
{
Destroy(impactP, 3.5f); // Removes impact effect after delay
}
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: