Tz2/Assets/Scripts/CarMoverToWeigh.cs

68 lines
1.8 KiB
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 卡车移动至称重
/// </summary>
public class CarMoverToWeigh : MonoBehaviour
{
public static CarMoverToWeigh Instance;
public Transform Point;
/// <summary>
/// 是否已卸货
/// </summary>
public bool IsUnload = false;
/// <summary>
/// 车上生成的模型预制体
/// </summary>
public GameObject CloneModel;
/// <summary>
/// 模型生成在车辆的位置
/// </summary>
public Transform CarClonePoint;
private void Awake()
{
Instance = this;
}
void Start()
{
//CloneModel = Instantiate(ModerController.Instance.prefabModel, transform);
//for (int i = 0; i < CloneModel.transform.childCount; i++)
//{
// CloneModel.transform.GetChild(i).gameObject.SetActive(false);
//}
//CloneModel.transform.position = CarClonePoint.transform.position;
}
/// <summary>
/// 汽车移动
/// </summary>
public void CarMove()
{
StartCoroutine(WaitCarMove());
}
// Update is called once per frame
void Update()
{
}
IEnumerator WaitCarMove()
{
if (IsUnload)
{
DocumentManagement.Instance.IsShowTrue("磅单-卸货后");
WeighBridgeCheck.instance.weightext.text = "16100KG";
UI_Tips.instance.ShowPanel("称重完成!", true);
}
else
{
DocumentManagement.Instance.IsShowTrue("磅单-卸货前");
transform.DOLocalMove(Point.position, 3f);
yield return new WaitForSeconds(3.1f);
WeighBridgeCheck.instance.weightext.text = "40100KG";
UI_Tips.instance.ShowPanel("称重完成!", true);
}
}
}