add some extra assets FX and SFX
This commit is contained in:
8
Assets/PixPlays/Components/Scripts/VfxSystem/AOE.meta
Normal file
8
Assets/PixPlays/Components/Scripts/VfxSystem/AOE.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 324b7cb5d419a104eab75e9708e218c9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class WindAoeVfx : LocationVfx
|
||||
{
|
||||
[SerializeField] Transform _GroundEffect;
|
||||
|
||||
public override void Play(VfxData data)
|
||||
{
|
||||
base.Play(data);
|
||||
_GroundEffect.transform.position = _data.Ground;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bb58f4e88a6323459deaf4cddb06797
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/AOE/WindAoeVfx.cs
|
||||
uploadId: 840846
|
||||
29
Assets/PixPlays/Components/Scripts/VfxSystem/BaseVfx.cs
Normal file
29
Assets/PixPlays/Components/Scripts/VfxSystem/BaseVfx.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class BaseVfx : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float _SafetyDestroy; //Destroy the object after a certan time in case user error keeps it active.
|
||||
[SerializeField] float _DestoyDelay; //Wait for effect to finish stopping before destroying the GameObject
|
||||
protected VfxData _data;
|
||||
public virtual void Play(VfxData data)
|
||||
{
|
||||
_data = data;
|
||||
if (_data.Duration > _SafetyDestroy)
|
||||
{
|
||||
_SafetyDestroy += _data.Duration;//Offset the safety destroy by the duration if bigger;
|
||||
}
|
||||
Destroy(gameObject, _SafetyDestroy);
|
||||
Invoke(nameof(Stop), _data.Duration);
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
public virtual void Stop()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
Destroy(gameObject, _DestoyDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/VfxSystem/BaseVfx.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/VfxSystem/BaseVfx.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e63092aa3556dc46b67238b9f26f929
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/BaseVfx.cs
|
||||
uploadId: 840846
|
||||
8
Assets/PixPlays/Components/Scripts/VfxSystem/Beams.meta
Normal file
8
Assets/PixPlays/Components/Scripts/VfxSystem/Beams.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78db5e895ca48914ab934b815eac3ce1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class BeamVfx : BaseVfx
|
||||
{
|
||||
[SerializeField] private ParticleSystem _BeamBodyEffect;
|
||||
[SerializeField] private ParticleSystem _CastEffect;
|
||||
[SerializeField] private ParticleSystem _HitEffect;
|
||||
[SerializeField] private ParticleSystem _BodyTip;
|
||||
|
||||
[SerializeField] private float _ScaleSpeed;
|
||||
private float _Length;
|
||||
|
||||
public override void Play(VfxData _data)
|
||||
{
|
||||
base.Play(_data);
|
||||
_Length = (_data.Target - _data.Source).magnitude;
|
||||
StartCoroutine(Coroutine_Play());
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
_BeamBodyEffect.Stop();
|
||||
_CastEffect.Stop();
|
||||
_HitEffect.Stop();
|
||||
_BodyTip.Stop();
|
||||
}
|
||||
|
||||
IEnumerator Coroutine_Play()
|
||||
{
|
||||
_HitEffect.gameObject.SetActive(false);
|
||||
_CastEffect.gameObject.SetActive(true);
|
||||
_BeamBodyEffect.gameObject.SetActive(true);
|
||||
_BodyTip.gameObject.SetActive(true);
|
||||
|
||||
float length = (_data.Target - _data.Source).magnitude;
|
||||
Vector3 direction = (_data.Target - _data.Source);
|
||||
|
||||
float lerp = 0;
|
||||
_CastEffect.transform.position = _data.Source;
|
||||
_CastEffect.transform.forward = direction;
|
||||
_CastEffect.Play();
|
||||
|
||||
_BeamBodyEffect.transform.position = _data.Source;
|
||||
_BeamBodyEffect.transform.forward = direction;
|
||||
_BeamBodyEffect.Play();
|
||||
|
||||
_BodyTip.Play();
|
||||
Vector3 startScale = _BeamBodyEffect.transform.localScale;
|
||||
startScale.z = 0;
|
||||
while (lerp < 1)
|
||||
{
|
||||
length = (_data.Target - _data.Source).magnitude;
|
||||
direction = (_data.Target - _data.Source);
|
||||
_CastEffect.transform.position = _data.Source;
|
||||
_CastEffect.transform.forward = direction;
|
||||
_BeamBodyEffect.transform.localScale = Vector3.Lerp(startScale, new Vector3(startScale.x, startScale.y, length), lerp);
|
||||
_BeamBodyEffect.transform.position = _data.Source;
|
||||
_BeamBodyEffect.transform.forward = direction;
|
||||
_BodyTip.transform.position = _data.Source + direction.normalized * _BeamBodyEffect.transform.localScale.z;
|
||||
_BodyTip.transform.forward = direction;
|
||||
lerp += (Time.deltaTime*_ScaleSpeed)/_Length;
|
||||
yield return null;
|
||||
}
|
||||
_BodyTip.transform.position = _data.Source + direction.normalized * _BeamBodyEffect.transform.localScale.z;
|
||||
_HitEffect.gameObject.SetActive(true);
|
||||
_HitEffect.transform.position = _data.Target;
|
||||
_HitEffect.transform.forward = -direction;
|
||||
_HitEffect.Play();
|
||||
|
||||
while (true)
|
||||
{
|
||||
length = (_data.Target - _data.Source).magnitude;
|
||||
direction = (_data.Target - _data.Source);
|
||||
_BodyTip.transform.position = _data.Source + direction.normalized * _BeamBodyEffect.transform.localScale.z;
|
||||
_CastEffect.transform.position = _data.Source;
|
||||
_CastEffect.transform.forward = direction;
|
||||
_BeamBodyEffect.transform.localScale = new Vector3(startScale.x, startScale.y, length);
|
||||
_BeamBodyEffect.transform.position = _data.Source;
|
||||
_BeamBodyEffect.transform.forward = direction;
|
||||
_HitEffect.transform.position = _data.Target;
|
||||
_HitEffect.transform.forward = -direction;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4a9fd255959ecd4ba215bccc466f49f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/Beams/BeamVfx.cs
|
||||
uploadId: 840846
|
||||
33
Assets/PixPlays/Components/Scripts/VfxSystem/LocationVfx.cs
Normal file
33
Assets/PixPlays/Components/Scripts/VfxSystem/LocationVfx.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
|
||||
public class LocationVfx : BaseVfx
|
||||
{
|
||||
[SerializeField] VfxReference _LocationEffect;
|
||||
[SerializeField] float _RadiusFactor;
|
||||
[SerializeField] bool _IgnoreYDirection;
|
||||
public override void Play(VfxData data)
|
||||
{
|
||||
base.Play(data);
|
||||
_LocationEffect.transform.localScale = Vector3.one * _RadiusFactor * _data.Radius;
|
||||
_LocationEffect.transform.position = data.Source;
|
||||
Vector3 direction = _data.Target - _data.Source;
|
||||
if (_IgnoreYDirection)
|
||||
{
|
||||
direction.y = 0;
|
||||
}
|
||||
_LocationEffect.transform.forward = direction;
|
||||
_LocationEffect.gameObject.SetActive(true);
|
||||
_LocationEffect.Play();
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
_LocationEffect.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a960bc488c2f3048a90116f91a3eaea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/LocationVfx.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class ParticleSystemVfx : VfxReference
|
||||
{
|
||||
[SerializeField] ParticleSystem _Vfx;
|
||||
|
||||
public override void Play()
|
||||
{
|
||||
_Vfx.Play();
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
_Vfx.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86361429be8c3a8429bb99c19a4d6b70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/ParticleSystemVfx.cs
|
||||
uploadId: 840846
|
||||
22
Assets/PixPlays/Components/Scripts/VfxSystem/PlayableVfx.cs
Normal file
22
Assets/PixPlays/Components/Scripts/VfxSystem/PlayableVfx.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class PlayableVfx : VfxReference
|
||||
{
|
||||
[SerializeField] PlayableDirector _Vfx;
|
||||
|
||||
public override void Play()
|
||||
{
|
||||
_Vfx.Play();
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
_Vfx.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 223d7af450bebc947a88a9da44ac257f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/PlayableVfx.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class ProjectileVfx : BaseVfx
|
||||
{
|
||||
[SerializeField] ParticleSystem _CastEffect;
|
||||
[SerializeField] ParticleSystem _HitEffect;
|
||||
[SerializeField] ParticleSystem _ProjectileEffect;
|
||||
[SerializeField] float _FlySpeed=1;
|
||||
[SerializeField] AnimationCurve _FlyCurve;
|
||||
[SerializeField] Vector2 _FlyCurveDirection;
|
||||
[SerializeField] bool _RandomizeFlyCurveDirection;
|
||||
[SerializeField] float _FlyCurveStrength;
|
||||
[SerializeField] float _ProjectileFlyDelay;
|
||||
[SerializeField] float _ProjectileDeactivateDelay;
|
||||
public override void Play(VfxData data)
|
||||
{
|
||||
base.Play(data);
|
||||
StartCoroutine(Coroutine_Projectile());
|
||||
}
|
||||
|
||||
IEnumerator Coroutine_Projectile()
|
||||
{
|
||||
_CastEffect.gameObject.SetActive(true);
|
||||
_CastEffect.transform.position = _data.Source;
|
||||
_CastEffect.transform.forward = (_data.Target - _data.Source);
|
||||
_CastEffect.Play();
|
||||
|
||||
yield return new WaitForSeconds(_ProjectileFlyDelay);
|
||||
_ProjectileEffect.gameObject.SetActive(true);
|
||||
_ProjectileEffect.transform.position = _CastEffect.transform.position;
|
||||
_ProjectileEffect.Play();
|
||||
|
||||
_FlyCurveDirection = _FlyCurveDirection.normalized;
|
||||
if (_RandomizeFlyCurveDirection)
|
||||
{
|
||||
_FlyCurveDirection = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)).normalized;
|
||||
}
|
||||
|
||||
float lerp = 0;
|
||||
Vector3 startPos = _ProjectileEffect.transform.position;
|
||||
while (lerp < 1)
|
||||
{
|
||||
Vector3 pos = Vector3.Lerp(startPos, _data.Target, lerp);
|
||||
pos += (Vector3)_FlyCurveDirection * _FlyCurve.Evaluate(lerp) * _FlyCurveStrength;
|
||||
if (lerp > 0)
|
||||
{
|
||||
_ProjectileEffect.transform.forward = (pos - _ProjectileEffect.transform.position);
|
||||
}
|
||||
_ProjectileEffect.transform.position = pos;
|
||||
lerp += Time.deltaTime/_FlySpeed;
|
||||
yield return null;
|
||||
}
|
||||
_HitEffect.transform.forward = (_ProjectileEffect.transform.position - _data.Target);
|
||||
|
||||
_ProjectileEffect.transform.position = _data.Target;
|
||||
_ProjectileEffect.Stop();
|
||||
|
||||
|
||||
_HitEffect.transform.position = _data.Target;
|
||||
_HitEffect.gameObject.SetActive(true);
|
||||
_HitEffect.Play();
|
||||
|
||||
yield return new WaitForSeconds(_ProjectileDeactivateDelay);
|
||||
_ProjectileEffect.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
if (gameObject != null)
|
||||
{
|
||||
_HitEffect.Stop();
|
||||
_ProjectileEffect.Stop();
|
||||
_CastEffect.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc0b5030ddf4124da4c7b09c7b00b2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/ProjectileVfx.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 447a4e56187eb0a448044c3295943d2f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,153 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class EarthShield : Shield
|
||||
{
|
||||
[SerializeField] List<Rigidbody> _ShardRigidbodies;
|
||||
[SerializeField] float _AnimSpeed;
|
||||
[SerializeField] AnimationCurve _AnimCurve;
|
||||
[SerializeField] ParticleSystem _SpawnExplosionEffectPrefab;
|
||||
[SerializeField] Transform _RotationObjectOuter;
|
||||
[SerializeField] Transform _RotationObjectInner;
|
||||
[SerializeField] float _RotationSpeedOuter;
|
||||
[SerializeField] float _RotationSpeedInner;
|
||||
[SerializeField] Vector2 _ShardRadiusSpawn;
|
||||
[SerializeField] ParticleSystem _HitEffectPrefab;
|
||||
[SerializeField] float _ShardScale;
|
||||
private List<MeshCollider> _meshColliders;
|
||||
private List<Vector3> _sourcePositions;
|
||||
private List<Quaternion> _sourceRotations;
|
||||
IEnumerator Coroutine_Animate()
|
||||
{
|
||||
StartCoroutine(Coroutine_Rotate());
|
||||
if (_sourcePositions == null)
|
||||
{
|
||||
_sourcePositions = new List<Vector3>();
|
||||
_sourceRotations = new List<Quaternion>();
|
||||
foreach (var i in _ShardRigidbodies)
|
||||
{
|
||||
_sourcePositions.Add(i.transform.localPosition);
|
||||
_sourceRotations.Add(i.transform.localRotation);
|
||||
}
|
||||
}
|
||||
if (_meshColliders == null)
|
||||
{
|
||||
_meshColliders=new List<MeshCollider>();
|
||||
foreach (var i in _ShardRigidbodies)
|
||||
{
|
||||
if(i.TryGetComponent<MeshCollider>(out MeshCollider collider))
|
||||
{
|
||||
_meshColliders.Add(collider);
|
||||
collider.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach(var i in _meshColliders)
|
||||
{
|
||||
i.enabled = false;
|
||||
}
|
||||
List<Vector3> shardPosition = new List<Vector3>();
|
||||
List<Quaternion> shardRotation = new List<Quaternion>();
|
||||
for (int i = 0; i < _ShardRigidbodies.Count; i++)
|
||||
{
|
||||
_ShardRigidbodies[i].gameObject.SetActive(true);
|
||||
_ShardRigidbodies[i].isKinematic = true;
|
||||
_ShardRigidbodies[i].transform.localScale= Vector3.one* _ShardScale;
|
||||
Vector3 dir = _ShardRigidbodies[i].transform.localPosition;//(_ShardRigidbodies[i].transform.position - transform.position);
|
||||
dir.y = 0;
|
||||
float distance = Random.Range(_ShardRadiusSpawn.x, _ShardRadiusSpawn.y);
|
||||
Quaternion rotation = Quaternion.Euler(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360));
|
||||
Vector3 pos = transform.position + dir.normalized * distance;
|
||||
Ray ray = new Ray(transform.position, Vector3.down);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit, 10))
|
||||
{
|
||||
pos.y = hit.point.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y = transform.position.y - 1;
|
||||
}
|
||||
shardPosition.Add(pos);
|
||||
shardRotation.Add(rotation);
|
||||
|
||||
ParticleSystem effect = Instantiate(_SpawnExplosionEffectPrefab, pos, Quaternion.identity);
|
||||
effect.Play();
|
||||
}
|
||||
float lerp = 0;
|
||||
while (lerp < 1)
|
||||
{
|
||||
for (int i = 0; i < _ShardRigidbodies.Count; i++)
|
||||
{
|
||||
_ShardRigidbodies[i].transform.localPosition = Vector3.Lerp(transform.InverseTransformPoint(shardPosition[i]),
|
||||
_sourcePositions[i], _AnimCurve.Evaluate(lerp));
|
||||
_ShardRigidbodies[i].transform.localRotation = Quaternion.Lerp(shardRotation[i], _sourceRotations[i], _AnimCurve.Evaluate(lerp));
|
||||
}
|
||||
lerp += Time.deltaTime * _AnimSpeed;
|
||||
yield return null;
|
||||
}
|
||||
for (int i = 0; i < _ShardRigidbodies.Count; i++)
|
||||
{
|
||||
_ShardRigidbodies[i].transform.localPosition = _sourcePositions[i];
|
||||
_ShardRigidbodies[i].transform.localRotation = _sourceRotations[i];
|
||||
}
|
||||
}
|
||||
IEnumerator Coroutine_Rotate()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
_RotationObjectInner.Rotate(0, _RotationSpeedInner * Time.deltaTime, 0);
|
||||
_RotationObjectOuter.Rotate(0, _RotationSpeedOuter * Time.deltaTime, 0);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
IEnumerator Coroutine_StopAnimation()
|
||||
{
|
||||
foreach (var i in _ShardRigidbodies)
|
||||
{
|
||||
i.isKinematic = false;
|
||||
}
|
||||
foreach(var i in _meshColliders)
|
||||
{
|
||||
i.enabled = true;
|
||||
}
|
||||
float lerp = 0;
|
||||
Vector3 startScale = Vector3.one* _ShardScale;
|
||||
Vector3 endScale = Vector3.zero;
|
||||
while (lerp < 1)
|
||||
{
|
||||
for (int i = 0; i < _ShardRigidbodies.Count; i++)
|
||||
{
|
||||
_ShardRigidbodies[i].transform.localScale = Vector3.Lerp(startScale, endScale,lerp);
|
||||
}
|
||||
lerp +=Time.deltaTime * _AnimSpeed;
|
||||
yield return null;
|
||||
}
|
||||
for(int i = 0; i < _ShardRigidbodies.Count; i++)
|
||||
{
|
||||
_ShardRigidbodies[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PlayImplementation()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(Coroutine_Animate());
|
||||
}
|
||||
|
||||
protected override void StopImplemenation()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(Coroutine_StopAnimation());
|
||||
}
|
||||
|
||||
protected override void HitImplementation(Vector3 point, Vector3 normal)
|
||||
{
|
||||
ParticleSystem effect = Instantiate(_HitEffectPrefab, point, Quaternion.identity);
|
||||
effect.transform.forward = normal;
|
||||
effect.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2308ce2b8d650e947a4e5a2282671f81
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/Shields/EarthShield.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class ParticleSystemShield : Shield
|
||||
{
|
||||
[SerializeField] ParticleSystem _ShieldEffect;
|
||||
[SerializeField] ParticleSystem _HitEffectPrefab;
|
||||
protected override void HitImplementation(Vector3 point, Vector3 normal)
|
||||
{
|
||||
ParticleSystem effect = Instantiate(_HitEffectPrefab, point, Quaternion.identity);
|
||||
effect.transform.forward = normal;
|
||||
effect.Play();
|
||||
}
|
||||
|
||||
protected override void PlayImplementation()
|
||||
{
|
||||
_ShieldEffect.Play();
|
||||
}
|
||||
|
||||
protected override void StopImplemenation()
|
||||
{
|
||||
_ShieldEffect.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba0ceba87b484834fbd93d5eb6bd97f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/Shields/ParticleSystemShield.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public abstract class Shield : BaseVfx, IHittable
|
||||
{
|
||||
[SerializeField] float _RadiusFactor;
|
||||
public override void Play(VfxData data)
|
||||
{
|
||||
base.Play(data);
|
||||
transform.position = data.Source;
|
||||
transform.localScale = Vector3.one * _RadiusFactor * _data.Radius;
|
||||
gameObject.SetActive(true);
|
||||
PlayImplementation();
|
||||
}
|
||||
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
StopImplemenation();
|
||||
}
|
||||
|
||||
protected abstract void PlayImplementation();
|
||||
protected abstract void StopImplemenation();
|
||||
protected abstract void HitImplementation(Vector3 point, Vector3 normal);
|
||||
|
||||
public void OnHit(Vector3 hitPoint, Vector3 normal)
|
||||
{
|
||||
HitImplementation(hitPoint, normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f5e5e7844aa51d49b287c6aeeba72a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/Shields/Shield.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class WaterShield : Shield
|
||||
{
|
||||
[SerializeField] ParticleSystem _HitEffectPrefab;
|
||||
[SerializeField] Animation _Anim;
|
||||
[SerializeField] AnimationClip _SpawnAnimation;
|
||||
[SerializeField] AnimationClip _DespawnAnimation;
|
||||
[SerializeField] ParticleSystem _WaterAdditionalParticles;
|
||||
protected override void HitImplementation(Vector3 point, Vector3 normal)
|
||||
{
|
||||
ParticleSystem effect = Instantiate(_HitEffectPrefab, point, Quaternion.identity);
|
||||
effect.transform.forward = normal;
|
||||
effect.Play();
|
||||
}
|
||||
|
||||
protected override void PlayImplementation()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
gameObject.SetActive(true);
|
||||
_WaterAdditionalParticles.Play();
|
||||
_Anim.clip = _SpawnAnimation;
|
||||
_Anim.Play();
|
||||
}
|
||||
|
||||
protected override void StopImplemenation()
|
||||
{
|
||||
_WaterAdditionalParticles.Stop();
|
||||
_Anim.clip = _DespawnAnimation;
|
||||
_Anim.Play();
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cce16e37289a5c848b032b5d23f27bc6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/Shields/WaterShield.cs
|
||||
uploadId: 840846
|
||||
62
Assets/PixPlays/Components/Scripts/VfxSystem/VfxData.cs
Normal file
62
Assets/PixPlays/Components/Scripts/VfxSystem/VfxData.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class VfxData
|
||||
{
|
||||
public Vector3 Source => _sourceTransform != null ? _sourceTransform.position : _sourcePos;
|
||||
public Vector3 Target => _targetTransform != null ? _targetTransform.position : _targetPos;
|
||||
public Vector3 Ground => _groundTransform != null ? _groundTransform.position : _groundPos;
|
||||
|
||||
public float Duration => _duration;
|
||||
public float Radius => _radius;
|
||||
|
||||
|
||||
private float _duration;
|
||||
private float _radius;
|
||||
private Transform _sourceTransform;
|
||||
private Transform _targetTransform;
|
||||
private Transform _groundTransform;
|
||||
private Vector3 _sourcePos;
|
||||
private Vector3 _targetPos;
|
||||
private Vector3 _groundPos;
|
||||
|
||||
public VfxData(Vector3 source,Vector3 target,float duration,float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
_sourcePos = source;
|
||||
_targetPos = target;
|
||||
_duration = duration;
|
||||
}
|
||||
public VfxData(Transform source, Vector3 target, float duration, float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
_sourceTransform = source;
|
||||
_sourcePos = source.position;
|
||||
_targetPos = target;
|
||||
_duration = duration;
|
||||
}
|
||||
|
||||
public VfxData(Transform source,Transform target,float duration,float radius)
|
||||
{
|
||||
_radius = radius;
|
||||
_sourceTransform = source;
|
||||
_targetTransform = target;
|
||||
_sourcePos = source.position;
|
||||
_targetPos = target.position;
|
||||
_duration = duration;
|
||||
}
|
||||
|
||||
public void SetGround(Transform groundPoint)
|
||||
{
|
||||
_groundTransform = groundPoint;
|
||||
_groundPos = _groundTransform.position;
|
||||
}
|
||||
|
||||
public void SetGround(Vector3 groundPos)
|
||||
{
|
||||
_groundPos = groundPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/VfxSystem/VfxData.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/VfxSystem/VfxData.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d8d617b489c1ef45874289fd9f9a539
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/VfxData.cs
|
||||
uploadId: 840846
|
||||
11
Assets/PixPlays/Components/Scripts/VfxSystem/VfxReference.cs
Normal file
11
Assets/PixPlays/Components/Scripts/VfxSystem/VfxReference.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public abstract class VfxReference : MonoBehaviour
|
||||
{
|
||||
public abstract void Play();
|
||||
public abstract void Stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79386e8892a8edd4ea3e6f3184e5e32b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 297318
|
||||
packageName: Elemental Spells Full Pack VFX
|
||||
packageVersion: 1.0.1
|
||||
assetPath: Assets/PixPlays/Components/Scripts/VfxSystem/VfxReference.cs
|
||||
uploadId: 840846
|
||||
Reference in New Issue
Block a user