63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "SplashPetIce" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public class SplashPetIce : MonoBehaviour
|
|||
|
{
|
|||
|
private Vector3 _targetPos;
|
|||
|
|
|||
|
private float _delay = 2.5f;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
_delay = 2.5f;
|
|||
|
_targetPos = transform.position;
|
|||
|
|
|||
|
Vector3 position = _targetPos;
|
|||
|
position.y = -0.4f;
|
|||
|
this.transform.position = position;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (_delay < 0f)
|
|||
|
{
|
|||
|
Vector3 pos = this.transform.position - Vector3.up * (Time.deltaTime * 2f);
|
|||
|
if (pos.y < -0.4f)
|
|||
|
{
|
|||
|
this.transform.position = Vector3.up * 12f;
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.transform.position = pos;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.transform.position = Vector3.MoveTowards(transform.position, _targetPos, Time.deltaTime * 2f);
|
|||
|
_delay -= Time.deltaTime;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|