2024-12-09 11:56:41 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class cardPlace : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private Transform parent;
|
|
|
|
|
public GameObject tower;
|
2024-12-09 18:01:59 +08:00
|
|
|
|
public string Tag;
|
2024-12-09 11:56:41 +08:00
|
|
|
|
public bool isInTrigger { get; set; }
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
isInTrigger = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
|
{
|
2024-12-09 18:01:59 +08:00
|
|
|
|
if (!isInTrigger&& collision.tag.Equals(Tag))
|
2024-12-09 11:56:41 +08:00
|
|
|
|
{
|
|
|
|
|
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><CEBD>봥<EFBFBD><EBB4A5><EFBFBD><EFBFBD>");
|
|
|
|
|
isInTrigger = true;
|
2024-12-09 18:01:59 +08:00
|
|
|
|
tower = collision.gameObject;
|
2024-12-09 11:56:41 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnTriggerExit2D(Collider2D collision)
|
|
|
|
|
{
|
2024-12-09 18:01:59 +08:00
|
|
|
|
if (isInTrigger&&collision.tag.Equals(Tag))
|
2024-12-09 11:56:41 +08:00
|
|
|
|
{
|
|
|
|
|
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
|
|
|
|
isInTrigger = false;
|
2024-12-09 18:01:59 +08:00
|
|
|
|
tower = null;
|
2024-12-09 11:56:41 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 18:01:59 +08:00
|
|
|
|
|
2024-12-09 11:56:41 +08:00
|
|
|
|
}
|