add some extra assets FX and SFX
This commit is contained in:
15
Assets/PixPlays/Components/Scripts/BindingPointType.cs
Normal file
15
Assets/PixPlays/Components/Scripts/BindingPointType.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public enum BindingPointType
|
||||
{
|
||||
Ground,
|
||||
LeftHand,
|
||||
RightHand,
|
||||
Middle,
|
||||
MiddleFront,
|
||||
Above
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/BindingPointType.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/BindingPointType.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e7f9fe30449431468e41dd0db119663
|
||||
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/BindingPointType.cs
|
||||
uploadId: 840846
|
||||
28
Assets/PixPlays/Components/Scripts/BindingPoints.cs
Normal file
28
Assets/PixPlays/Components/Scripts/BindingPoints.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class BindingPoints : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class BindingPointData
|
||||
{
|
||||
public BindingPointType Type;
|
||||
public Transform Point;
|
||||
}
|
||||
|
||||
[SerializeField] private List<BindingPointData> _BindingPoints;
|
||||
|
||||
public Transform GetBindingPoint(BindingPointType type)
|
||||
{
|
||||
BindingPointData data = _BindingPoints.Find(x => x.Type == type);
|
||||
if (data != null)
|
||||
{
|
||||
return data.Point;
|
||||
}
|
||||
Debug.LogError($"Binding type {type.ToString()} not defined");
|
||||
return transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/BindingPoints.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/BindingPoints.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 370a1d629dd1a9c4888f0c6f2dc8a6f5
|
||||
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/BindingPoints.cs
|
||||
uploadId: 840846
|
||||
45
Assets/PixPlays/Components/Scripts/Character.cs
Normal file
45
Assets/PixPlays/Components/Scripts/Character.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public class Character : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Animator _Anim;
|
||||
[SerializeField] BindingPoints _BindingPoints;
|
||||
[SerializeField] Transform _Target;
|
||||
|
||||
private AnimatorOverrideController _overrideController;
|
||||
public BindingPoints BindingPoints => _BindingPoints;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (_Anim.runtimeAnimatorController != null)
|
||||
{
|
||||
_overrideController = new AnimatorOverrideController(_Anim.runtimeAnimatorController);
|
||||
_Anim.runtimeAnimatorController = _overrideController;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayAnimation(string clipId,AnimationClip clip)
|
||||
{
|
||||
if (_overrideController != null)
|
||||
{
|
||||
_overrideController[clipId] = clip;
|
||||
_Anim.SetTrigger("Play");
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetTarget()
|
||||
{
|
||||
Vector3 direction = (_Target.position - transform.position).normalized;
|
||||
Ray ray = new Ray(transform.position, direction);
|
||||
RaycastHit hit;
|
||||
if(Physics.Raycast(ray,out hit,100))
|
||||
{
|
||||
return hit.point;
|
||||
}
|
||||
return _Target.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/Character.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/Character.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e9b53c087e71254bba0bb30969c1995
|
||||
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/Character.cs
|
||||
uploadId: 840846
|
||||
10
Assets/PixPlays/Components/Scripts/IHittable.cs
Normal file
10
Assets/PixPlays/Components/Scripts/IHittable.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
public interface IHittable
|
||||
{
|
||||
public void OnHit(Vector3 hitPoint,Vector3 normal);
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/IHittable.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/IHittable.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf751bd706db8bb49a727ad44771b6f4
|
||||
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/IHittable.cs
|
||||
uploadId: 840846
|
||||
52
Assets/PixPlays/Components/Scripts/VFXTester.cs
Normal file
52
Assets/PixPlays/Components/Scripts/VFXTester.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
|
||||
public class VFXTester : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class TestingData
|
||||
{
|
||||
public string Name;
|
||||
public AnimationClip clip;
|
||||
public float VfxSpawnDelay;
|
||||
public BindingPointType Source;
|
||||
public float _Duration;
|
||||
public float _Radius;
|
||||
public BaseVfx VFX;
|
||||
}
|
||||
|
||||
[SerializeField] List<TestingData> _Data;
|
||||
[SerializeField] Character _Character;
|
||||
[SerializeField] string _CurrentData;
|
||||
[SerializeField] private Button _ActivateButton;
|
||||
|
||||
private int index = 0;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_ActivateButton.onClick.AddListener(OnActivateButtonClicked);
|
||||
}
|
||||
|
||||
private void OnActivateButtonClicked()
|
||||
{
|
||||
StartCoroutine(Coroutine_Spawn());
|
||||
}
|
||||
|
||||
IEnumerator Coroutine_Spawn()
|
||||
{
|
||||
_Character.PlayAnimation("New Animation", _Data[index].clip);
|
||||
yield return new WaitForSeconds(_Data[index].VfxSpawnDelay);
|
||||
BaseVfx go = Instantiate(_Data[index].VFX);
|
||||
Transform sourcePoint = _Character.BindingPoints.GetBindingPoint(_Data[index].Source);
|
||||
var vfxData = new VfxData(sourcePoint, _Character.GetTarget(), _Data[index]._Duration, _Data[index]._Radius);
|
||||
vfxData.SetGround(_Character.BindingPoints.GetBindingPoint(BindingPointType.Ground));
|
||||
go.Play(vfxData);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/PixPlays/Components/Scripts/VFXTester.cs.meta
Normal file
18
Assets/PixPlays/Components/Scripts/VFXTester.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34c90761894663a459ee1d0c0af7f53e
|
||||
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/VFXTester.cs
|
||||
uploadId: 840846
|
||||
8
Assets/PixPlays/Components/Scripts/VfxAddons.meta
Normal file
8
Assets/PixPlays/Components/Scripts/VfxAddons.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07a0072d8364ab142b1c523023dc7638
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
[RequireComponent(typeof(ParticleSystem))]
|
||||
public class ParticleSystemScaleLifetime : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float _LifetimeFactor;
|
||||
[SerializeField] Transform _ScaleObject;
|
||||
private ParticleSystem _particleSystem;
|
||||
private bool _playedFlag;
|
||||
private void Awake()
|
||||
{
|
||||
_particleSystem = GetComponent<ParticleSystem>();
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (_particleSystem.isPlaying)
|
||||
{
|
||||
ParticleSystem.MainModule main = _particleSystem.main;
|
||||
main.startLifetime = _LifetimeFactor * _ScaleObject.localScale.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9acc547824e458345b4524902b21069d
|
||||
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/VfxAddons/ParticleSystemScaleLifetime.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
[RequireComponent(typeof(ParticleSystem))]
|
||||
public class ParticleSystemStartStopLifetime : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float _StartLifetime;
|
||||
[SerializeField] private float _StopLifetime;
|
||||
private ParticleSystem _particleSystem;
|
||||
private bool _playedFlag;
|
||||
private void Awake()
|
||||
{
|
||||
_particleSystem = GetComponent<ParticleSystem>();
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (_particleSystem.isEmitting && !_playedFlag)
|
||||
{
|
||||
_playedFlag = true;
|
||||
}
|
||||
if (!_particleSystem.isEmitting && _playedFlag)
|
||||
{
|
||||
ParticleSystem.Particle[] particles = new ParticleSystem.Particle[_particleSystem.particleCount];
|
||||
_particleSystem.GetParticles(particles);
|
||||
for (int i = 0; i < particles.Length; i++)
|
||||
{
|
||||
float percentage = particles[i].remainingLifetime / particles[i].startLifetime;
|
||||
particles[i].startLifetime = _StopLifetime;
|
||||
particles[i].remainingLifetime = _StopLifetime * percentage;
|
||||
}
|
||||
_particleSystem.SetParticles(particles);
|
||||
_playedFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 255c58e12f3e05245afde891bf9647ea
|
||||
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/VfxAddons/ParticleSystemStartStopLifetime.cs
|
||||
uploadId: 840846
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace PixPlays.ElementalVFX
|
||||
{
|
||||
[RequireComponent(typeof(TrailRenderer))]
|
||||
public class TrailScaleWithHierarchy : MonoBehaviour
|
||||
{
|
||||
private TrailRenderer _trailRenderer;
|
||||
private float _initialWidth;
|
||||
private float _initialTrailTime;
|
||||
private void Start()
|
||||
{
|
||||
_trailRenderer = GetComponent<TrailRenderer>();
|
||||
_initialWidth = _trailRenderer.widthMultiplier;
|
||||
_initialTrailTime = _trailRenderer.time;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
_trailRenderer.widthMultiplier = GetWorldScale(transform, _initialWidth);
|
||||
_trailRenderer.time = _initialTrailTime * _trailRenderer.widthMultiplier;
|
||||
}
|
||||
|
||||
private float GetWorldScale(Transform obj,float scale=1)
|
||||
{
|
||||
float newScale = obj.localScale.x * scale;
|
||||
if (obj.parent != null)
|
||||
{
|
||||
return GetWorldScale(obj.parent, newScale);
|
||||
}
|
||||
return newScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da1b031a13b76d34892fdc5af6a0d348
|
||||
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/VfxAddons/TrailScaleWithHierarchy.cs
|
||||
uploadId: 840846
|
||||
8
Assets/PixPlays/Components/Scripts/VfxSystem.meta
Normal file
8
Assets/PixPlays/Components/Scripts/VfxSystem.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8969e7d8d6679c5489a741519fc71cd1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
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