95 lines
1.9 KiB
C#
95 lines
1.9 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "SkillBamboo" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
|
|||
|
[RequireComponent(typeof(SkillBase))]
|
|||
|
public class SkillBamboo : MonoBehaviour
|
|||
|
{
|
|||
|
public int colliderOff;
|
|||
|
|
|||
|
public float finishDelay = 2.2f;
|
|||
|
|
|||
|
private float _delay;
|
|||
|
|
|||
|
private Collider _collider;
|
|||
|
|
|||
|
private Vector3 _originPos;
|
|||
|
|
|||
|
private bool _next;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_collider = this.GetComponent<Collider>();
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
_originPos = transform.position;
|
|||
|
_originPos.y = 0f;
|
|||
|
_delay = 0f;
|
|||
|
_collider.enabled = true;
|
|||
|
_collider.isTrigger = true;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
_delay += Time.deltaTime;
|
|||
|
if (_delay > finishDelay)
|
|||
|
{
|
|||
|
transform.position -= Vector3.up * Time.deltaTime * 4f;
|
|||
|
Vector3 position = transform.position;
|
|||
|
if (position.y < -1f)
|
|||
|
{
|
|||
|
_next = false;
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
transform.position = Vector3.one * 5f;
|
|||
|
}
|
|||
|
}
|
|||
|
else if (_delay > 0.5f)
|
|||
|
{
|
|||
|
if (!_next)
|
|||
|
{
|
|||
|
if (colliderOff == 0)
|
|||
|
{
|
|||
|
_collider.enabled = false;
|
|||
|
transform.position = _originPos;
|
|||
|
}
|
|||
|
else if (colliderOff == 1)
|
|||
|
{
|
|||
|
_collider.isTrigger = false;
|
|||
|
transform.position = _originPos;
|
|||
|
}
|
|||
|
_next = true;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Vector3 position = transform.position;
|
|||
|
if (position.y >= 0f)
|
|||
|
{
|
|||
|
transform.position = _originPos;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
transform.position += Vector3.up * Time.deltaTime * 3f;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|