initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System.Security.Cryptography;
|
||||
using UnityEngine;
|
||||
|
||||
public class Collectible : MonoBehaviour
|
||||
{
|
||||
public float rotationSpeed;
|
||||
public GameObject onCollectEffect;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(0, rotationSpeed, 0);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
// Check on Player
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
// Destroy the collectible
|
||||
Destroy(gameObject);
|
||||
|
||||
// instantiate the particle effect
|
||||
Instantiate(onCollectEffect, transform.position, transform.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user