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

50 lines
1.3 KiB
C#

// ***********************************************************************
// Assembly : Unity
// Author : Kimch
// Created : 2017-11-14
//
// Last Modified By : Kimch
// Last Modified On :
// ***********************************************************************
// <copyright file= "Obj_break" company=""></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
public class Obj_break : MonoBehaviour
{
public bool isrunning;
private float _speed = 1.8f;
private void Start()
{
GetComponent<Animation>()["obj_break"].speed = 0.25f;
if (!isrunning)
{
Destroy(gameObject, 1.2f);
}
}
private void Update()
{
if (isrunning)
{
_speed -= 2.2f * Time.deltaTime;
Vector3 position = transform.position;
if (position.z > -0.6f)
{
position.z += _speed * Time.deltaTime;
transform.position = position;
}
else
{
Destroy(this.gameObject);
}
}
}
}
}