118 lines
2.6 KiB
C#
118 lines
2.6 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-09-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "SkillChainBreak" company="Kimch"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
public class SkillChainBreak : MonoBehaviour
|
|
{
|
|
//private ParticleEmitter myparticleEmitter;
|
|
|
|
private Transform _ptExp;
|
|
|
|
private float _delayExp;
|
|
|
|
private short _step;
|
|
|
|
private SphereCollider _childCollider;
|
|
|
|
private Collider _collider;
|
|
|
|
private void Awake()
|
|
{
|
|
//myparticleEmitter = base.particleEmitter;
|
|
_collider = this.GetComponent<Collider>();
|
|
_ptExp = transform.GetChild(0);
|
|
_childCollider = (_ptExp.GetComponent<Collider>() as SphereCollider);
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
_ptExp.GetComponent<Rigidbody>().mass = this.GetComponent<Rigidbody>().mass;
|
|
_ptExp.gameObject.SetActive(false);
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
//myparticleEmitter.ClearParticles();
|
|
_collider.enabled = false;
|
|
//myparticleEmitter.emit = true;
|
|
_delayExp = 0f;
|
|
InvokeRepeating(nameof(RepeatDamage), 0.1f, 0.4f);
|
|
_step = 0;
|
|
this.GetComponent<AudioSource>().Play();
|
|
}
|
|
|
|
private void RepeatDamage()
|
|
{
|
|
_collider.enabled = false;
|
|
_collider.enabled = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
_delayExp += Time.deltaTime;
|
|
Vector3 position = transform.position;
|
|
if (position.y < 0.1f)
|
|
{
|
|
transform.position += Vector3.up * 0.6f * Time.deltaTime;
|
|
}
|
|
if (_step == 2)
|
|
{
|
|
if (_delayExp > 4f)
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
_ptExp.gameObject.SetActive(false);
|
|
transform.position = Vector3.one * 30f;
|
|
_step = 0;
|
|
}
|
|
}
|
|
else if (_step == 1)
|
|
{
|
|
if (_delayExp > 2.5f)
|
|
{
|
|
//pt_exp.particleEmitter().emit = false;
|
|
_childCollider.enabled = false;
|
|
_childCollider.radius = 0.01f;
|
|
_step = 2;
|
|
}
|
|
}
|
|
else if (_step == 0 && _delayExp > 2f)
|
|
{
|
|
_collider.enabled = false;
|
|
CancelInvoke();
|
|
_step = 1;
|
|
//myparticleEmitter.ClearParticles();
|
|
//myparticleEmitter.emit = false;
|
|
_ptExp.gameObject.SetActive(true);
|
|
//pt_exp.particleEmitter().emit = true;
|
|
_childCollider.enabled = true;
|
|
_childCollider.radius = 0.7f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class ParticleEmitter
|
|
{
|
|
public float minEnergy;
|
|
public float maxEnergy;
|
|
public bool emit;
|
|
public void ClearParticles()
|
|
{
|
|
|
|
}
|
|
public void Emit()
|
|
{
|
|
|
|
}
|
|
} |