You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PinTrigger : MonoBehaviour
{
public GameObject part;
public GameObject flag;
public GameObject stand;
public string triggerTag;
private bool isTrigger = false;
void OnTriggerEnter(Collider other) {
if (other.tag == triggerTag)
{
//part.SetActive(false);
flag.SetActive(true);
isTrigger = true;
}
}
void OnTriggerExit(Collider other) {
if (other.tag == triggerTag)
{
part.SetActive(true);
flag.SetActive(false);
isTrigger = false;
}
}
private void Update()
{
if (Input.GetMouseButtonUp(0))
{
if (isTrigger)
{
part.SetActive(false);
flag.SetActive(false);
stand.SetActive(true);
gameObject.SetActive(false);
PinGM.target++;
}
}
}
}