81 lines
1.9 KiB
C#
81 lines
1.9 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-09-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "SkillMeteo" company="Kimch"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
/// <summary>
|
|
/// 陨石
|
|
/// </summary>
|
|
[RequireComponent(typeof(SkillBase))]
|
|
public class SkillMeteo : MonoBehaviour
|
|
{
|
|
private bool _fallDown;
|
|
|
|
private Vector3 _currentPos;
|
|
private Vector3 _direction;
|
|
|
|
private Collider _collider;
|
|
private float _finishDelay;
|
|
|
|
private Ef_boom _scriptBoom;
|
|
|
|
private void Awake()
|
|
{
|
|
_collider = this.GetComponent<Collider>();
|
|
_scriptBoom = GameObject.FindWithTag("skill").GetComponent<Ef_boom>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
//mytransform.GetChild(0).particleEmitter().emit = true;
|
|
//mytransform.GetChild(1).particleEmitter().emit = true;
|
|
_fallDown = true;
|
|
_finishDelay = 0f;
|
|
_direction = transform.forward - Vector3.up * 0.7f;
|
|
transform.up = -_direction;
|
|
_currentPos = transform.position;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (_fallDown)
|
|
{
|
|
Vector3 position = transform.position;
|
|
if (position.y > 0f)
|
|
{
|
|
_currentPos += _direction * 0.08f;
|
|
}
|
|
else
|
|
{
|
|
_collider.enabled = true;
|
|
_fallDown = false;
|
|
_currentPos.y = 0f;
|
|
_scriptBoom.SetTex(0, _currentPos, true);
|
|
}
|
|
transform.position = _currentPos;
|
|
}
|
|
else if (_finishDelay > 2f)
|
|
{
|
|
//mytransform.GetChild(0).particleEmitter().emit = false;
|
|
//mytransform.GetChild(1).particleEmitter().emit = false;
|
|
this.gameObject.SetActive(false);
|
|
_collider.enabled = false;
|
|
}
|
|
else
|
|
{
|
|
_finishDelay += Time.deltaTime;
|
|
}
|
|
}
|
|
}
|
|
}
|