Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
597 B
1
Indexable
Never
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Coin : MonoBehaviour
{
    public Transform playerTransform;
    public float moveSpeed = 17f;

    
    CoinMove cm;

    void Start()
    {
        
        cm = FindObjectOfType<CoinMove>();
        playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
     
      if(collision.gameObject.tag == "CoinDetector")
        {
           
            cm.enabled = true;
        }  
    }
}
Leave a Comment