52 lines
1.4 KiB
C#
Raw Permalink Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-16
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Ef_Coin" company="KUNPO"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
/// <summary>
///
/// </summary>
public class Ef_Coin : MonoBehaviour
{
private float _delayFinish;
private Vector3 _targetPos;
private void Awake()
{
this.gameObject.SetActive(false);
}
public void GetCoin(Vector3 pos)
{
transform.position = pos;
_targetPos = pos;
_targetPos.y = 0.65f;
_delayFinish = 0f;
this.gameObject.SetActive(true);
}
private void Update()
{
_delayFinish += Time.deltaTime;
if (_delayFinish > 0.5f)
{
this.gameObject.SetActive(false);
return;
}
transform.position = Vector3.Lerp(transform.position, _targetPos, Time.deltaTime * 15f);
transform.Rotate(Vector3.up * 1200f * Time.deltaTime);
}
}
}