// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
using UnityEngine;
namespace G
{
public class Wing : MonoBehaviour
{
private Transform _wingMesh;
private float _delay;
private Animation _animation;
private void Awake()
{
_animation = this.GetComponent();
_wingMesh = transform.GetChild(2);
}
private void OnEnable()
{
_wingMesh.gameObject.SetActive(true);
_animation.Play("wing_start");
_delay = 0f;
}
private void Start()
{
_animation["wing_fly"].speed = 0.5f;
_animation["wing_attack"].speed = 0.25f;
_animation["wing_start"].speed = 2.2f;
}
private void Update()
{
_delay += Time.deltaTime;
if (_delay > 4f)
{
this.gameObject.SetActive(false);
_wingMesh.gameObject.SetActive(false);
_animation.Stop();
}
else if (_delay > 3f)
{
_animation.CrossFade("wing_attack");
}
else if (_delay > 0.6f)
{
_animation.Play("wing_fly");
}
}
}
}