78 lines
1.6 KiB
C#
78 lines
1.6 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Poisonball" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public class Poisonball : MonoBehaviour
|
|||
|
{
|
|||
|
private float _shootDelay;
|
|||
|
|
|||
|
private Vector3 _shootDir;
|
|||
|
|
|||
|
private bool _explode;
|
|||
|
|
|||
|
private ParticleSystem _particle;
|
|||
|
|
|||
|
private Transform _boom;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_particle = GetComponent<ParticleSystem>();
|
|||
|
}
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
_shootDir = transform.parent.forward - Vector3.up * 0.5f;
|
|||
|
_boom = GameObject.FindWithTag("skill").transform;
|
|||
|
transform.parent = null;
|
|||
|
}
|
|||
|
|
|||
|
private void ColliderOff()
|
|||
|
{
|
|||
|
this.GetComponent<Collider>().enabled = false;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (_explode)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (_shootDelay > 1f)
|
|||
|
{
|
|||
|
Vector3 position = transform.position;
|
|||
|
position += _shootDir * (Time.deltaTime * 2.5f);
|
|||
|
transform.position = position;
|
|||
|
if (position.y <= 0f)
|
|||
|
{
|
|||
|
this.GetComponent<Collider>().enabled = true;
|
|||
|
Invoke(nameof(ColliderOff), 0.4f);
|
|||
|
_explode = true;
|
|||
|
//_particle.rndVelocity = Vector3.one;
|
|||
|
_boom.GetComponent<Ef_boom>().SetTex(2, position, true);
|
|||
|
|
|||
|
Destroy(this.gameObject, 1.2f);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_shootDelay += Time.deltaTime;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|