98 lines
2.0 KiB
C#
98 lines
2.0 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-07
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Mon_Destroy" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public class Mon_Destroy : MonoBehaviour
|
|||
|
{
|
|||
|
public Transform headbone;
|
|||
|
|
|||
|
private float _delayFinish;
|
|||
|
private float _downAccel = 1f;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
GetComponent<Animator>().speed = 0.3f;
|
|||
|
gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void FinishNow()
|
|||
|
{
|
|||
|
_delayFinish = 5f;
|
|||
|
}
|
|||
|
|
|||
|
public void TextureChange(Texture a, Vector3 scale, int kind)
|
|||
|
{
|
|||
|
_delayFinish = 0f;
|
|||
|
_downAccel = 0f;
|
|||
|
if (kind == 2)
|
|||
|
{
|
|||
|
//var tmpList = F.ListPool<Renderer>.Get();
|
|||
|
//GetComponentsInChildren(tmpList);
|
|||
|
//foreach (var r in tmpList)
|
|||
|
//{
|
|||
|
// r.material.mainTexture = a;
|
|||
|
//}
|
|||
|
//F.ListPool<Renderer>.Release(tmpList);
|
|||
|
|
|||
|
if (scale.x > 1f)
|
|||
|
{
|
|||
|
transform.localScale = scale * 1.2f;
|
|||
|
headbone.localScale = Vector3.one * 0.7f;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
transform.localScale = Vector3.one * 1.2f;
|
|||
|
headbone.localScale = Vector3.one;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GetComponent<Animator>().speed = 0.55f;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (_delayFinish > 3f)
|
|||
|
{
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
this.transform.position = Vector3.one * 6f;
|
|||
|
_delayFinish = 0f;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_delayFinish += Time.deltaTime;
|
|||
|
}
|
|||
|
|
|||
|
Vector3 position = this.transform.position;
|
|||
|
if (position.y > 0f)
|
|||
|
{
|
|||
|
_downAccel += Time.deltaTime * 5f;
|
|||
|
this.transform.position -= Vector3.up * (Time.deltaTime * _downAccel);
|
|||
|
return;
|
|||
|
}
|
|||
|
position.y = 0f;
|
|||
|
this.transform.position = position;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|