init
This commit is contained in:
commit
102013b228
1443 changed files with 1065651 additions and 0 deletions
33
Assets/Scripts/BalloonFight/BalloonSplash.cs
Normal file
33
Assets/Scripts/BalloonFight/BalloonSplash.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BalloonSplash : MonoBehaviour, IPooledObject{
|
||||
|
||||
[SerializeField] float timeToDisappear = 10f;
|
||||
[SerializeField] float disappearDuration = 1f;
|
||||
float currentTime;
|
||||
|
||||
Animator anim;
|
||||
|
||||
void Awake(){
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
public void OnObjectSpawn(){
|
||||
currentTime = 0;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
currentTime += Time.deltaTime;
|
||||
if (currentTime >= timeToDisappear - disappearDuration){
|
||||
anim.SetTrigger("Destroy");
|
||||
}
|
||||
}
|
||||
|
||||
public void Disable(){
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue