64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Snake_base" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
namespace G
|
|||
|
{
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class Snake_base : MonoBehaviour
|
|||
|
{
|
|||
|
private float _finishDelay;
|
|||
|
private Collider _collider;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_collider = this.GetComponent<Collider>();
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
_finishDelay = 0f;
|
|||
|
transform.localScale = Vector3.zero;
|
|||
|
transform.GetChild(0).gameObject.SetActive(true);
|
|||
|
transform.GetChild(1).gameObject.SetActive(true);
|
|||
|
//base.particleEmitter().emit = true;
|
|||
|
InvokeRepeating(nameof(ColliderOn), 0.3f, 0.5f);
|
|||
|
}
|
|||
|
|
|||
|
private void ColliderOn()
|
|||
|
{
|
|||
|
_collider.enabled = false;
|
|||
|
_collider.enabled = true;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
_finishDelay += Time.deltaTime;
|
|||
|
if (_finishDelay > 8f)
|
|||
|
{
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
transform.GetChild(0).gameObject.SetActive(false);
|
|||
|
transform.GetChild(1).gameObject.SetActive(false);
|
|||
|
CancelInvoke();
|
|||
|
}
|
|||
|
else if (_finishDelay > 6f)
|
|||
|
{
|
|||
|
//base.particleEmitter().emit = false;
|
|||
|
transform.localScale = Vector3.MoveTowards(transform.localScale, Vector3.zero, Time.deltaTime * 3f);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
transform.localScale = Vector3.MoveTowards(transform.localScale, Vector3.one, Time.deltaTime * 3f);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|