Soulaha Balde f29d349fde Add guiding coins
Remove grapple charges
2022-10-29 22:30:08 -04:00

39 lines
786 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collectible : MonoBehaviour
{
[SerializeField]
private int amount;
[SerializeField]
private float rotSpeed;
[SerializeField]
private float timeToAppear;
void Update()
{
transform.Rotate(0, rotSpeed, 0, Space.World);
}
private void OnTriggerEnter(Collider other) {
if(other.gameObject.tag.Equals("Player")){
Vanish();
}
}
private void Vanish(){
gameObject.SetActive(false);
if(timeToAppear > -1){
Invoke("Appear", timeToAppear);
}else{
Destroy(this.gameObject);
}
}
private void Appear(){
gameObject.SetActive(true);
}
}