E_ElecCompetition/Electrical_inspectionCompet.../Assets/Script/Interactive objects/tizi_count.cs

55 lines
934 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class tizi_count : MonoBehaviour
{
public GameObject mubiao;
public GameObject player;
public GameObject ÅÀÉÏ;
public bool first = true;
// Start is called before the first frame update
void Start()
{
ÅÀÉÏ.GetComponent<Button>().onClick.AddListener(tiziup);
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
if (first == true)
{ ÅÀÉÏ.SetActive(true);
first = false;
}
}
private void OnTriggerExit(Collider other)
{
first = true;
ÅÀÉÏ.SetActive(false);
}
public void tiziup()
{
player.transform.DOMove(mubiao.transform.position, 2f);
ÅÀÉÏ.SetActive(false);
}
}