You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
3.1 KiB
114 lines
3.1 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class ActiveSkill : MonoBehaviour |
|
{ |
|
[Space(20)] |
|
public Character owner; |
|
[Space(10)] |
|
public int layer; |
|
[Space(10)] |
|
public bool targetUser = false; |
|
public float delay = 1.5f; |
|
[Space(10)] |
|
public DamageType damageType = DamageType.None; |
|
public float damageValue = 50; |
|
[Space(10)] |
|
public int cntPenetrate = 10; |
|
//OnCreate onCreate; |
|
//public void OnInitialized(Character owner, int layer, OnCreate onCreate = null) |
|
public void OnInitialized(Character owner, int layer) |
|
{ |
|
this.owner = owner; |
|
this.layer = layer; |
|
//this.onCreate = onCreate; |
|
|
|
if (hitParticle != null) |
|
hitParticle.OnInitialized(owner, Create); |
|
|
|
for(int i = 0; i < hitCheck.Count; i++) |
|
{ |
|
hitCheck[i].damageType = damageType; |
|
hitCheck[i].damageValue = damageValue; |
|
hitCheck[i].Initialized(owner, layer, cntPenetrate, null); |
|
} |
|
|
|
if (scvOn != null) |
|
scvOn.Stop(); |
|
Play(scvOff); |
|
|
|
if (hitParticle != null) |
|
hitParticle.gameObject.SetActive(true); |
|
isPlay = particle != null; |
|
} |
|
|
|
bool isPlay = false; |
|
private void Update() |
|
{ |
|
if (isPlay && !particle.isPlaying) |
|
{ |
|
particle.Stop(); |
|
particle.time = 0; |
|
gameObject.SetActive(false); |
|
|
|
isPlay = false; |
|
} |
|
} |
|
|
|
[Space(10)] |
|
public SpriteRenderer markTarget; |
|
public ShaderControlValue scvOn; |
|
public ShaderControlValue scvOff; |
|
void Play(ShaderControlValue scv) |
|
{ |
|
if (markTarget != null) |
|
{ |
|
Material mat = null; |
|
if (scv != null && (mat = scv.InitPlay()) != null) |
|
markTarget.material = mat; |
|
} |
|
} |
|
[Space(10)] |
|
public ParticleSystem particle; |
|
public HitCheck_Particle hitParticle; |
|
private void OnEnable() |
|
{ |
|
if (markTarget != null) |
|
{ |
|
Play(scvOn); |
|
markTarget.gameObject.SetActive(true); |
|
} |
|
} |
|
private void OnDisable() |
|
{ |
|
isPlay = false; |
|
if (hitParticle != null) |
|
hitParticle.gameObject.SetActive(false); |
|
} |
|
public HitCheck prefabHitEffect; |
|
[Space(10)] |
|
public List<HitCheck> hitCheck; |
|
[Space(10)] |
|
public float tiltPow = 0.1f; |
|
public float tiltTime = 0.1f; |
|
void Create(Vector3 pos) |
|
{ |
|
EventManager.ObjectCreate create = new EventManager.ObjectCreate(prefabHitEffect.gameObject, null, Vector3.one, pos); |
|
EventManager.Instance.Invoke("ObjectCreate", create); |
|
|
|
//HitCheck hit = onCreate(prefabHitEffect.gameObject, null, Vector3.one, pos).GetComponent<HitCheck>(); |
|
HitCheck hit = create.create.GetComponent<HitCheck>(); |
|
hit.damageType = damageType; |
|
hit.damageValue = damageValue; |
|
hit.Initialized(owner, layer, cntPenetrate, null); |
|
|
|
Tilt(true); |
|
} |
|
|
|
public void Tilt(bool HIT) |
|
{ |
|
if (HIT) |
|
owner.map.tiltCamera.Shaking(tiltPow, tiltTime); |
|
} |
|
}
|
|
|