2025-05-18 01:04:31 +08:00

53 lines
1.3 KiB
C#

// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Wind_axe" company="Kimch"></copyright>
// <summary></summary>
// ***********************************************************************
namespace G
{
using UnityEngine;
public class Wind_axe : MonoBehaviour
{
private Transform cha1;
private Vector3 _originScale;
private float _finishDelay;
private void Awake()
{
cha1 = GameObject.FindWithTag("Player").transform;
_originScale = transform.localScale;
transform.GetChild(0).GetComponent<Animation>()["tornado"].speed = 0.2f;
}
private void OnEnable()
{
transform.localScale = Vector3.zero;
transform.GetChild(0).gameObject.SetActive(true);
_finishDelay = 0f;
}
private void Update()
{
transform.position = cha1.position;
_finishDelay += Time.deltaTime;
if (_finishDelay > 1.5f)
{
transform.localScale = Vector3.MoveTowards(transform.localScale, Vector3.zero, Time.deltaTime * 5f);
}
else
{
transform.localScale = Vector3.MoveTowards(transform.localScale, _originScale, Time.deltaTime * 3f);
}
}
}
}