Coin
Mon Dec 09 2024 09:00:09 GMT+0000 (Coordinated Universal Time)
Saved by
@iliavial
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Coin : MonoBehaviour
{
public float rotateSpeed = 180.0f;
// Update is called once per frame
void Update()
{
transform.Rotate(Vector3.up, rotateSpeed * Time.deltaTime);
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
other.GetComponent<PlayerController>().AddScore(1);
Destroy(gameObject);
}
}
}
content_copyCOPY
Comments