| 12345678910111213141516171819202122232425262728293031 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FullscreenClearBubbleBehavior : MonoBehaviour
- {
- const float SpreadSpeed = 120f;
- const float Lifetime = 2f;
- float Age = 0f;
- private SphereCollider ClearCollider;
- // Start is called before the first frame update
- void Start()
- {
- ClearCollider = gameObject.GetComponent<SphereCollider>();
- }
- // Update is called once per frame
- void Update()
- {
- Age += Time.deltaTime;
- if (Age > Lifetime)
- {
- Destroy(gameObject);
- return;
- }
- float radius = SpreadSpeed * Time.deltaTime;
- ClearCollider.radius += radius;
- }
- }
|