using DefaultNamespace; using DG.Tweening; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Warehousingdata : MonoBehaviour { [Header("设备ID")] public string ID; [Header("位移速度")] public float Speed = 3.5f; [Header("正传判断点位是否有箱子")] public Transform Onschedule; [Header("正转需要位移的点位")] public Transform Onschedule2; [Header("反转需要判断点位有箱子")] public Transform Antipoint1; [Header("反转需要位移的点位")] public Transform Antipoint2; [Header("提升机反转需要位移的点位")] public Transform Reversing; [Header("提升机反转需要位移点位2")] public Transform Reversing2; void Start() { } public void Equipmentdata(Convoyorequipment convoyorequipment) { if (convoyorequipment.TaskNumber != "0") { if (convoyorequipment.ForwardRotation == "True") { Intotheforword(); } else if (convoyorequipment.ReverseRotation == "True") { Tothereversal(); } } } /// /// 正传点位 /// public void Intotheforword() { if (Onschedule.childCount > 0) { GameObject box = Onschedule.transform.GetChild(0).gameObject; if (box != null) { box.transform.SetParent(null); box.transform.DOMove(Onschedule2.position, (Vector3.Distance(box.transform.position, Onschedule2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() => { box.transform.SetParent(Onschedule2); }); } } } /// /// 反转点位需要判断 /// public void Tothereversal() { if (Antipoint1.childCount > 0) { GameObject box = Antipoint1.transform.GetChild(0).gameObject; if(box != null) { box.transform.SetParent(null); box.transform.DOMove(Antipoint2.position, (Vector3.Distance(box.transform.position, Antipoint2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() => { box.transform.SetParent(Antipoint2); }); } } else if (GetComponent()) { Hoistmovement hoistmovement = GetComponent(); if (hoistmovement) { if (hoistmovement.Downpoint.transform.childCount > 0 && Reversing) { GameObject box = hoistmovement.Downpoint.transform.GetChild(0).gameObject; if (box) { box.transform.SetParent (null); box.transform.DOMove(Reversing.position, (Vector3.Distance(box.transform.position, Reversing.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() => { box.transform.SetParent(Reversing); }); } } else if(hoistmovement.UPpoint.transform.childCount > 0 && Reversing2) { GameObject box = hoistmovement.UPpoint.transform.GetChild (0).gameObject; if (box) { box.transform.SetParent (null); box.transform.DOMove(Reversing2.position, (Vector3.Distance(box.transform.position, Reversing2.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() => { box.transform.SetParent(Reversing2); }); } } } } } }