first commit
This commit is contained in:
44
Assets/dobot/Sc/RobotManager.cs
Normal file
44
Assets/dobot/Sc/RobotManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class RobotManager : MonoBehaviour
|
||||
{
|
||||
public RobotController abb;
|
||||
public Robot2Controller yas;
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(AbbLoop());
|
||||
StartCoroutine(YasLoop());
|
||||
}
|
||||
bool IsAtTarget3()
|
||||
{
|
||||
return yas.HasPhoiAtTarget3();
|
||||
}
|
||||
IEnumerator AbbLoop()
|
||||
{
|
||||
|
||||
for (int i = 0; i < abb.stackCount; i++)
|
||||
{
|
||||
yield return new WaitUntil(() => !IsAtTarget3());
|
||||
yield return StartCoroutine(abb.RunStepsExternal());
|
||||
|
||||
// ✅ Sau khi ABB đặt phôi, đưa phôi vào queue của YAS
|
||||
yas.EnqueuePhoi(abb.LastStackObject);
|
||||
}
|
||||
Debug.Log("ABB hoàn thành tất cả vòng");
|
||||
}
|
||||
|
||||
IEnumerator YasLoop()
|
||||
{
|
||||
|
||||
for (int i = 0; i < abb.stackCount; i++)
|
||||
{
|
||||
// Đợi tới khi có phôi ở target3
|
||||
yield return new WaitUntil(() => IsAtTarget3());
|
||||
yield return StartCoroutine(yas.RunStepsExternal());
|
||||
}
|
||||
|
||||
Debug.Log("YAS hoàn thành tất cả vòng");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user