Untitled

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

public class ActivateMagnet : MonoBehaviour
{
  
  
    GameObject CoinDetector;
    public bool canAttract = false;
    PickupManager pm;
    ObjectPooler op;


    private void Awake()
    {
        op = ObjectPooler.instance;
    }
    void Start()
    {
       // CoinDetector = GameObject.FindGameObjectWithTag("CoinDetector");
       // CoinDetector.SetActive(false);
        pm = FindObjectOfType<PickupManager>();

    }

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.gameObject.tag == "Player")
        {
           
            pm.SelectMagnet();
           // Destroy(transform.GetChild(0).gameObject);
            op.DeactivateGameObject(transform.GetChild(0).gameObject.tag , transform.GetChild(0).gameObject);
            op.DeactivateGameObject(gameObject.tag, gameObject);
        }
    }

  

}
Leave a Comment