going_balls/Assets/Scripts/CoinScript.cs
2025-02-15 14:29:00 +05:30

27 lines
554 B
C#

using UnityEngine;
public class CoinScript : MonoBehaviour
{
public GameManager gameManager;
public Vector3 RotatingSpeed;
// 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(RotatingSpeed);
}
void OnTriggerEnter(Collider other)
{
if(other.tag=="Ball")
{
Destroy(gameObject);
gameManager.AddCoins();
}
}
}