불필요 코드 삭제
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbb638c0b84cdf34b89683812b841a5f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public abstract class NeedsScanner
|
||||
{
|
||||
protected List<FactoryNeeds> needs = new();
|
||||
public event Action<NeedsScanner, List<FactoryNeeds>> onScanningComplete;
|
||||
|
||||
public abstract void Scanning();
|
||||
|
||||
protected void ScanningComplete()
|
||||
{
|
||||
onScanningComplete.Invoke(this, needs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9161584bea128bd4682c86acad11beca
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class ResourceNeedsScanner : NeedsScanner
|
||||
{
|
||||
private readonly PortMap portMap;
|
||||
|
||||
public ResourceNeedsScanner(PortMap portMap)
|
||||
{
|
||||
this.portMap = portMap;
|
||||
}
|
||||
|
||||
public override void Scanning()
|
||||
{
|
||||
GeneratePortCheck();
|
||||
ScanningComplete();
|
||||
}
|
||||
|
||||
private void GeneratePortCheck()
|
||||
{
|
||||
if(portMap.TryGetEmptyGeneratePorts(out var ports))
|
||||
{
|
||||
for (int i = 0; i < ports.Count; i++)
|
||||
{
|
||||
needs.Add(FactoryNeeds.GenerateLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5dd1a0ad71ecdc645894bbfbdf539446
|
||||
@@ -1,225 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Studio.Manage;
|
||||
using Studio.Test;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public enum FactoryNeeds
|
||||
{
|
||||
GenerateAGV,
|
||||
StackerInputLoad,
|
||||
Stacking,
|
||||
GenerateLoad,
|
||||
StackerLoadOut,
|
||||
}
|
||||
|
||||
public class VirtualFactoryManager : MonoBehaviour
|
||||
{
|
||||
public List<StackerCrane> stackerCranes = new();
|
||||
public AGVManager agvManager;
|
||||
public AGVMap agvMap;
|
||||
public PortMap portMap;
|
||||
public List<Product> loads = new();
|
||||
public Product prf_Load;
|
||||
public AGVNode startNode;
|
||||
|
||||
public bool stackerHasEmptyCell;
|
||||
public int maxAGVCount = 4;
|
||||
|
||||
public List<FactoryNeeds> needs = new();
|
||||
|
||||
public AGVNeedsScanner agvNeedScanner;
|
||||
public ResourceNeedsScanner resourceNeedsChecker;
|
||||
public StackerCraneNeedsScanner stackerNeedsChecker;
|
||||
public List<NeedsScanner> scanners = new();
|
||||
|
||||
HashSet<StackerCrane> stackingReadys = new();
|
||||
private StackerCraneManager stackerCraneManager;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
agvMap = FindSingle<AGVMap>();
|
||||
portMap = FindSingle<PortMap>();
|
||||
agvManager = ManagerHub.instance.Get<AGVManager>();
|
||||
stackerCranes = FindObjectsByType<StackerCrane>(UnityEngine.FindObjectsSortMode.None).ToList();
|
||||
|
||||
agvNeedScanner = new AGVNeedsScanner(this, agvManager);
|
||||
resourceNeedsChecker = new ResourceNeedsScanner(portMap);
|
||||
stackerNeedsChecker = new StackerCraneNeedsScanner(this, stackerCraneManager);
|
||||
|
||||
scanners.Add(agvNeedScanner);
|
||||
scanners.Add(resourceNeedsChecker);
|
||||
scanners.Add(stackerNeedsChecker);
|
||||
|
||||
agvNeedScanner.onScanningComplete += OnScanningComplete;
|
||||
resourceNeedsChecker.onScanningComplete += OnScanningComplete;
|
||||
stackerNeedsChecker.onScanningComplete += OnScanningComplete;
|
||||
|
||||
Scanning();
|
||||
}
|
||||
|
||||
void Scanning()
|
||||
{
|
||||
Debug.Log("Needs Scanning");
|
||||
foreach (var scanner in scanners)
|
||||
{
|
||||
scanner.Scanning();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScanningComplete(NeedsScanner scanner, List<FactoryNeeds> list)
|
||||
{
|
||||
Debug.Log($"On Needs Scanning Complete {scanner.GetType().Name}");
|
||||
switch (scanner)
|
||||
{
|
||||
case AGVNeedsScanner _:
|
||||
AGVNeedsSolutioning(list);
|
||||
break;
|
||||
case ResourceNeedsScanner _:
|
||||
ResourceNeedsSolutioning(list);
|
||||
break;
|
||||
case StackerCraneNeedsScanner _:
|
||||
StackerNeedsSolutioning(list);
|
||||
break;
|
||||
}
|
||||
list.Clear();
|
||||
}
|
||||
|
||||
private void StackerNeedsSolutioning(List<FactoryNeeds> list)
|
||||
{
|
||||
foreach (var needs in list)
|
||||
{
|
||||
switch (needs)
|
||||
{
|
||||
case FactoryNeeds.StackerInputLoad:
|
||||
DeliveryStackerInputLoad();
|
||||
break;
|
||||
case FactoryNeeds.Stacking:
|
||||
StackerStacking();
|
||||
break;
|
||||
case FactoryNeeds.StackerLoadOut:
|
||||
StackerLoadOut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StackerLoadOut()
|
||||
{
|
||||
foreach (var stacker in stackerCranes)
|
||||
{
|
||||
stacker.AddTask(new OutputTask());
|
||||
}
|
||||
}
|
||||
|
||||
private void ResourceNeedsSolutioning(List<FactoryNeeds> list)
|
||||
{
|
||||
foreach (var needs in list)
|
||||
{
|
||||
switch (needs)
|
||||
{
|
||||
case FactoryNeeds.GenerateLoad:
|
||||
GenerateLoad();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AGVNeedsSolutioning(List<FactoryNeeds> list)
|
||||
{
|
||||
foreach (var needs in list)
|
||||
{
|
||||
switch (needs)
|
||||
{
|
||||
case FactoryNeeds.GenerateAGV:
|
||||
GenerateAGV();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StackerStacking()
|
||||
{
|
||||
foreach (var stacker in stackerCranes)
|
||||
{
|
||||
if (stackingReadys.Add(stacker) && !stacker.inputPort.isEmpty)
|
||||
{
|
||||
Debug.Log("Stacker Stacking");
|
||||
stacker.onCompleteTask += OnStackerStackingComplete;
|
||||
stacker.AddTask(new InputTask());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStackerStackingComplete(StackerCrane crane)
|
||||
{
|
||||
stackingReadys.Remove(crane);
|
||||
crane.onCompleteTask -= OnStackerStackingComplete;
|
||||
resourceNeedsChecker.Scanning();
|
||||
stackerNeedsChecker.Scanning();
|
||||
}
|
||||
private void OnStackerInputLoad(StackerCrane stacker)
|
||||
{
|
||||
Debug.Log($"Stacker {stacker.name} is On Input Load");
|
||||
stacker.inputPort.onLoadEvent -= () => OnStackerInputLoad(stacker);
|
||||
}
|
||||
|
||||
|
||||
private void DeliveryStackerInputLoad()
|
||||
{
|
||||
if (!agvManager.TryGetIdleAGV(out var agvWorker))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!portMap.TryGetFullGeneratePort(out var generatePort))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!agvMap.TryGetEmptyInputPortNode(out var inputPortNode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var startNode = agvWorker.currentNode;
|
||||
var generateNode = generatePort.GetComponent<AGVNode>();
|
||||
var getLoadPath = agvMap.FindPath(startNode, generateNode);
|
||||
var inputLoadPath = agvMap.FindPath(generateNode, inputPortNode);
|
||||
agvWorker.AddAction(new AGVMoveAction(getLoadPath));
|
||||
agvWorker.AddAction(new AGVLoadAction(generatePort));
|
||||
agvWorker.AddAction(new AGVMoveAction(inputLoadPath));
|
||||
agvWorker.AddAction(new AGVUnloadAction(inputPortNode.loader));
|
||||
agvWorker.onCompleteTask += OnAGVIdle;
|
||||
}
|
||||
|
||||
void OnAGVIdle(AGV worker)
|
||||
{
|
||||
Debug.Log($"{worker.name} is On Enter idle");
|
||||
stackerNeedsChecker.Scanning();
|
||||
worker.onCompleteTask -= OnAGVIdle;
|
||||
}
|
||||
|
||||
private void GenerateLoad()
|
||||
{
|
||||
if(portMap.TryGetEmptyGeneratePort(out var port))
|
||||
{
|
||||
Debug.Log($"GenerateLoad");
|
||||
var newLoad = Instantiate(prf_Load);
|
||||
port.Load(newLoad);
|
||||
loads.Add(newLoad);
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateAGV()
|
||||
{
|
||||
Debug.Log($"GenerateAGV");
|
||||
var newAGV = agvManager.CreateEmptyAGV();
|
||||
newAGV.ForceSet(startNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6eb9e1609cd682646a916778a2ae8797
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71051a821548bcc42bea4ddf060a7cc6
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11a0e7ca8ef4b2744a65180f3c9e01b0
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23e85b75c7e7c1f489cdf586fb723d47
|
||||
2
Assets/Scripts/Studio/Interfaces/ICommand.cs.meta
Normal file
2
Assets/Scripts/Studio/Interfaces/ICommand.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58e0bc1206dea0f4eaa4f827b1aca9d6
|
||||
7
Assets/Scripts/Studio/Interfaces/IEntity.cs
Normal file
7
Assets/Scripts/Studio/Interfaces/IEntity.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Studio.Interfaces
|
||||
{
|
||||
public interface IEntity
|
||||
{
|
||||
public string id { get; }
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/Interfaces/IEntity.cs.meta
Normal file
2
Assets/Scripts/Studio/Interfaces/IEntity.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6cefdbd5039fc04aae4f15894f108d4
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31fe22ae7ce70714f9b68a123a77a76d
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb46a3e67312513498e97ee4ed76d1f6
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c79a8930971834a44ad0d0e9fa727b77
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2d962f3e22ef92489864cc2fd559791
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,346 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGV : Loader
|
||||
{
|
||||
public enum AGVState
|
||||
{
|
||||
IdleReady,
|
||||
Moving,
|
||||
Charging,
|
||||
Loading,
|
||||
Unloading,
|
||||
Error,
|
||||
MoveReady,
|
||||
RotateReady,
|
||||
Rotating,
|
||||
LiftingUp,
|
||||
LiftingDown,
|
||||
LiftUpEnd,
|
||||
LiftDownEnd,
|
||||
LoadReady,
|
||||
MoveEnd,
|
||||
LoadEnd,
|
||||
UnloadReady,
|
||||
UnloadEnd,
|
||||
Idle
|
||||
}
|
||||
|
||||
public AGVState state;
|
||||
public AGVSpec spec;
|
||||
public Battery battery;
|
||||
public AGVNode currentNode;
|
||||
public AGVAction currentAction;
|
||||
public List<AGVNode> currentMovePath;
|
||||
protected override Transform loadPivot => lift.transform;
|
||||
|
||||
public AGVLift lift;
|
||||
Queue<AGVAction> actionQueue = new();
|
||||
public Vector3 liftUpPosition;
|
||||
public Vector3 liftDownPosition;
|
||||
public float liftUpProgress;
|
||||
public float liftDownProgress;
|
||||
|
||||
float rotateProgress;
|
||||
Quaternion targetRotation;
|
||||
Quaternion startRotation;
|
||||
public float moveProgress;
|
||||
Vector3 moveStartPos;
|
||||
Vector3 nextTargetPos;
|
||||
public AGVNode nextNode;
|
||||
internal Action<AGV> onCompleteTask;
|
||||
|
||||
internal bool isBusy => actionQueue.Count > 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
updateAction = IdleReady;
|
||||
lift = GetComponentInChildren<AGVLift>();
|
||||
liftUpPosition = lift.transform.localPosition;
|
||||
liftDownPosition = lift.transform.localPosition;
|
||||
liftUpPosition.y = 0.1f;
|
||||
}
|
||||
|
||||
public void ChangeState(AGVState newState)
|
||||
{
|
||||
Debug.Log($"{name} is State Changed: {state} -> {newState}");
|
||||
switch (newState)
|
||||
{
|
||||
case AGVState.IdleReady:
|
||||
updateAction = IdleReady;
|
||||
break;
|
||||
case AGVState.Idle:
|
||||
updateAction = Idle;
|
||||
break;
|
||||
case AGVState.MoveReady:
|
||||
updateAction = MoveReady;
|
||||
break;
|
||||
case AGVState.RotateReady:
|
||||
updateAction = RotateReady;
|
||||
break;
|
||||
case AGVState.Rotating:
|
||||
updateAction = Rotating;
|
||||
break;
|
||||
case AGVState.Moving:
|
||||
updateAction = Moving;
|
||||
break;
|
||||
case AGVState.MoveEnd:
|
||||
updateAction = MoveEnd;
|
||||
break;
|
||||
case AGVState.Charging:
|
||||
updateAction = Charging;
|
||||
break;
|
||||
case AGVState.LiftingUp:
|
||||
updateAction = LiftingUp;
|
||||
break;
|
||||
case AGVState.LiftUpEnd:
|
||||
updateAction = LiftUpEnd;
|
||||
break;
|
||||
case AGVState.LoadReady:
|
||||
updateAction = LoadReady;
|
||||
break;
|
||||
case AGVState.Loading:
|
||||
updateAction = Loading;
|
||||
break;
|
||||
case AGVState.LoadEnd:
|
||||
updateAction = LoadEnd;
|
||||
break;
|
||||
case AGVState.UnloadReady:
|
||||
updateAction = UnloadReady;
|
||||
break;
|
||||
case AGVState.LiftingDown:
|
||||
updateAction = LiftingDown;
|
||||
break;
|
||||
case AGVState.LiftDownEnd:
|
||||
updateAction = LiftDownEnd;
|
||||
break;
|
||||
case AGVState.Unloading:
|
||||
updateAction = Unloading;
|
||||
break;
|
||||
case AGVState.UnloadEnd:
|
||||
updateAction = UnloadEnd;
|
||||
break;
|
||||
case AGVState.Error:
|
||||
updateAction = Error;
|
||||
break;
|
||||
}
|
||||
state = newState;
|
||||
}
|
||||
|
||||
private void Idle()
|
||||
{
|
||||
if(actionQueue.Count > 0)
|
||||
{
|
||||
ExecuteNextAction();
|
||||
}
|
||||
}
|
||||
|
||||
private void LiftDownEnd()
|
||||
{
|
||||
ChangeState(AGVState.Unloading);
|
||||
}
|
||||
|
||||
private void UnloadEnd()
|
||||
{
|
||||
ChangeState(AGVState.IdleReady);
|
||||
}
|
||||
|
||||
private void Unloading()
|
||||
{
|
||||
(currentAction as AGVUnloadAction).targetLoader.Load(currentLoad);
|
||||
Debug.Log($"{name} is Unloading to {(currentAction as AGVUnloadAction).targetLoader}");
|
||||
ChangeState(AGVState.UnloadEnd);
|
||||
}
|
||||
|
||||
private void UnloadReady()
|
||||
{
|
||||
ChangeState(AGVState.LiftingDown);
|
||||
}
|
||||
private void LiftingDown()
|
||||
{
|
||||
liftDownProgress += (spec.liftSpeed * Time.deltaTime) / spec.liftSpeed;
|
||||
lift.transform.localPosition = Vector3.Lerp(liftUpPosition, liftDownPosition, liftDownProgress);
|
||||
|
||||
if (liftDownProgress >= 1f)
|
||||
{
|
||||
liftDownProgress = 0f;
|
||||
ChangeState(AGVState.LiftDownEnd);
|
||||
}
|
||||
}
|
||||
private void LoadEnd()
|
||||
{
|
||||
ChangeState(AGVState.IdleReady);
|
||||
}
|
||||
|
||||
private void LiftUpEnd()
|
||||
{
|
||||
ChangeState(AGVState.Loading);
|
||||
}
|
||||
|
||||
|
||||
private void LoadReady()
|
||||
{
|
||||
var target = (currentAction as AGVLoadAction).targetLoader;
|
||||
if (target.isEmpty)
|
||||
{
|
||||
Debug.Log($"{target} is Empty Load!");
|
||||
ChangeState(AGVState.IdleReady);
|
||||
return;
|
||||
}
|
||||
|
||||
ChangeState(AGVState.LiftingUp);
|
||||
}
|
||||
|
||||
|
||||
private void LiftingUp()
|
||||
{
|
||||
liftUpProgress += (spec.liftSpeed * Time.deltaTime) / spec.liftSpeed;
|
||||
lift.transform.localPosition = Vector3.Lerp(liftDownPosition, liftUpPosition, liftUpProgress);
|
||||
if (liftUpProgress >= 1f)
|
||||
{
|
||||
liftUpProgress = 0f;
|
||||
ChangeState(AGVState.LiftUpEnd);
|
||||
}
|
||||
}
|
||||
|
||||
private void RotateReady()
|
||||
{
|
||||
Vector3 targetPosition = nextNode.transform.position;
|
||||
Vector3 direction = (targetPosition - transform.position).normalized;
|
||||
startRotation = transform.rotation;
|
||||
targetRotation = Quaternion.LookRotation(direction);
|
||||
ChangeState(AGVState.Rotating);
|
||||
}
|
||||
|
||||
void Rotating()
|
||||
{
|
||||
rotateProgress += (spec.spinSpeed * Time.deltaTime)/spec.spinSpeed;
|
||||
transform.rotation = Quaternion.Lerp(startRotation, targetRotation, rotateProgress);
|
||||
|
||||
if (rotateProgress >= 1f)
|
||||
{
|
||||
rotateProgress = 0;
|
||||
ChangeState(AGVState.Moving);
|
||||
}
|
||||
}
|
||||
|
||||
private void Error()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
private void Loading()
|
||||
{
|
||||
(currentAction as AGVLoadAction).targetLoader.Unload(this);
|
||||
ChangeState(AGVState.LoadEnd);
|
||||
}
|
||||
|
||||
private void Charging()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
float moveDistance;
|
||||
private void MoveReady()
|
||||
{
|
||||
currentMovePath = (currentAction as AGVMoveAction).path;
|
||||
nextNode = currentMovePath[0];
|
||||
nextTargetPos = nextNode.transform.position;
|
||||
Vector3 direction = (nextTargetPos - transform.position).normalized;
|
||||
Quaternion targetRotation = Quaternion.LookRotation(direction);
|
||||
moveStartPos = transform.position;
|
||||
|
||||
moveDistance = Vector3.Distance(moveStartPos, nextTargetPos);
|
||||
if (Quaternion.Angle(transform.rotation, targetRotation) > 1f)
|
||||
{
|
||||
ChangeState(AGVState.RotateReady);
|
||||
return;
|
||||
}
|
||||
ChangeState(AGVState.Moving);
|
||||
}
|
||||
private void Moving()
|
||||
{
|
||||
moveProgress += (spec.maxSpeed * Time.deltaTime)/moveDistance;
|
||||
transform.position = Vector3.Lerp(moveStartPos, nextTargetPos, moveProgress);
|
||||
|
||||
if (moveProgress>=1f)
|
||||
{
|
||||
ChangeState(AGVState.MoveEnd);
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveEnd()
|
||||
{
|
||||
var prevNode = currentNode;
|
||||
currentNode = nextNode;
|
||||
prevNode.reserved = false;
|
||||
currentMovePath.RemoveAt(0);
|
||||
moveProgress = 0f;
|
||||
if (currentMovePath.Count > 0)
|
||||
{
|
||||
ChangeState(AGVState.MoveReady);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeState(AGVState.IdleReady);
|
||||
}
|
||||
}
|
||||
void IdleReady()
|
||||
{
|
||||
if(actionQueue.Count > 0)
|
||||
{
|
||||
ExecuteNextAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
onCompleteTask?.Invoke(this);
|
||||
ChangeState(AGVState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceSet(AGVNode node)
|
||||
{
|
||||
currentNode = node;
|
||||
transform.position = node.transform.position;
|
||||
currentNode.reserved = true;
|
||||
}
|
||||
|
||||
public void AddAction(AGVAction action)
|
||||
{
|
||||
actionQueue.Enqueue(action);
|
||||
}
|
||||
|
||||
private void ExecuteNextAction()
|
||||
{
|
||||
Debug.Log($"{name} is Execute Next Action. Left ActionQueue={actionQueue.Count}");
|
||||
currentAction = actionQueue.Dequeue();
|
||||
|
||||
switch (currentAction)
|
||||
{
|
||||
case AGVMoveAction move:
|
||||
ChangeState(AGVState.MoveReady);
|
||||
break;
|
||||
|
||||
case AGVLoadAction load:
|
||||
ChangeState(AGVState.LoadReady);
|
||||
break;
|
||||
|
||||
case AGVUnloadAction unload:
|
||||
ChangeState(AGVState.UnloadReady);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
event Action updateAction;
|
||||
private void Update()
|
||||
{
|
||||
updateAction.Invoke();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84fe5a7ef78a7af498da388fc7c38ac3
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Studio.Test;
|
||||
|
||||
public class AGVAction
|
||||
{
|
||||
}
|
||||
|
||||
public class AGVMoveAction : AGVAction
|
||||
{
|
||||
public List<AGVNode> path;
|
||||
|
||||
public AGVMoveAction(List<AGVNode> path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
public class AGVLoadAction : AGVAction
|
||||
{
|
||||
public Loader targetLoader;
|
||||
|
||||
public AGVLoadAction(Loader targetLoader)
|
||||
{
|
||||
this.targetLoader = targetLoader;
|
||||
}
|
||||
}
|
||||
|
||||
public class AGVUnloadAction : AGVAction
|
||||
{
|
||||
public Loader targetLoader;
|
||||
|
||||
public AGVUnloadAction(Loader targetLoader)
|
||||
{
|
||||
this.targetLoader = targetLoader;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18cd343e58c5d8f4b9e8f214b57ccf63
|
||||
@@ -1,17 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using Studio.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVEntity: IEntity
|
||||
{
|
||||
public Vector3 position;
|
||||
public Quaternion rotation;
|
||||
public string id { get; set; }
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9246ea54580e7c49944fa59e16c111d
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Studio.Test;
|
||||
using XRLib;
|
||||
|
||||
namespace Studio.Manage
|
||||
{
|
||||
public class AGVManager : Manager
|
||||
{
|
||||
public AGV prf_AGV;
|
||||
public AGVSpec prf_Spec;
|
||||
public HashSet<AGV> agvs = new();
|
||||
public bool autoIndexing;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool TryGetIdleAGV(out AGV result)
|
||||
{
|
||||
//Debug.Log($"Try Get Idle AGV");
|
||||
foreach (var agv in agvs)
|
||||
{
|
||||
if (!agv.isBusy)
|
||||
{
|
||||
Debug.Log($"Find Idle AGV");
|
||||
result = agv;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public AGV CreateEmptyAGV()
|
||||
{
|
||||
var agv = UnityEngine.Object.Instantiate(prf_AGV);
|
||||
agvs.Add(agv);
|
||||
|
||||
if (autoIndexing)
|
||||
{
|
||||
agv.entity = new AGVEntity();
|
||||
agv.entity.id = agvs.Count.ToString();
|
||||
agv.name = $"AGV_{agv.entity.id}";
|
||||
}
|
||||
agv.spec = prf_Spec;
|
||||
return agv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43c2fa2860dfa344d856558ec881bb8a
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public enum BatteryState
|
||||
{
|
||||
Full,
|
||||
High,
|
||||
Middle,
|
||||
Low,
|
||||
Empty
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Battery
|
||||
{
|
||||
public event Action onBatteryFull;
|
||||
public event Action onBatteryHigh;
|
||||
public event Action onBatteryMiddle;
|
||||
public event Action onBatteryLow;
|
||||
public event Action onBatteryEmpty;
|
||||
|
||||
public BatteryState currentBatteryState;
|
||||
float batteryCapacityMax = 100f;
|
||||
public float bc = 100f;
|
||||
|
||||
public float batteryCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return bc;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > batteryCapacityMax)
|
||||
{
|
||||
value = batteryCapacityMax;
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
bc = value;
|
||||
UpdateBatteryState();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBatteryState()
|
||||
{
|
||||
var newState = GetBatteryState();
|
||||
|
||||
if (newState != currentBatteryState)
|
||||
{
|
||||
currentBatteryState = newState;
|
||||
|
||||
switch (newState)
|
||||
{
|
||||
case BatteryState.Full:
|
||||
onBatteryFull?.Invoke();
|
||||
break;
|
||||
case BatteryState.High:
|
||||
onBatteryHigh?.Invoke();
|
||||
break;
|
||||
case BatteryState.Middle:
|
||||
onBatteryMiddle?.Invoke();
|
||||
break;
|
||||
case BatteryState.Low:
|
||||
onBatteryLow?.Invoke();
|
||||
break;
|
||||
case BatteryState.Empty:
|
||||
onBatteryEmpty?.Invoke();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BatteryState GetBatteryState()
|
||||
{
|
||||
if (bc == batteryCapacityMax)
|
||||
{
|
||||
return BatteryState.Full;
|
||||
}
|
||||
else if (bc >= batteryCapacityMax * 2 / 3)
|
||||
{
|
||||
return BatteryState.High;
|
||||
}
|
||||
else if (bc >= batteryCapacityMax / 3)
|
||||
{
|
||||
return BatteryState.Middle;
|
||||
}
|
||||
else if (bc > 0)
|
||||
{
|
||||
return BatteryState.Low;
|
||||
}
|
||||
else
|
||||
{
|
||||
return BatteryState.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(float max=100f)
|
||||
{
|
||||
if (max <= 1)
|
||||
{
|
||||
Debug.Log("설정된 배터리 양이 너무 적어 100으로 설정합니다");
|
||||
max = 100f;
|
||||
}
|
||||
batteryCapacityMax = max;
|
||||
batteryCapacity = batteryCapacityMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9106ef48f80ce55449851f004f7a824e
|
||||
@@ -1,98 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public class BezierCurve : MonoBehaviour
|
||||
{
|
||||
public static Vector3 GetPoint(Vector3 p0, Vector3 p1, Vector3 p2, float t)
|
||||
{
|
||||
float u = 1 - t;
|
||||
float tt = t * t;
|
||||
float uu = u * u;
|
||||
|
||||
Vector3 p = uu * p0; // (1-t)^2 * p0
|
||||
p += 2 * u * t * p1; // 2 * (1-t) * t * p1
|
||||
p += tt * p2; // t^2 * p2
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* not Use
|
||||
//세 점의 외심을 구하는 함수
|
||||
public static Vector3 CalculateCircumcenter(Vector3 A, Vector3 B, Vector3 C)
|
||||
{
|
||||
// 각 점의 좌표
|
||||
float x1 = A.x, y1 = A.z;
|
||||
float x2 = B.x, y2 = B.z;
|
||||
float x3 = C.x, y3 = C.z;
|
||||
|
||||
// 외심의 x좌표 계산
|
||||
float D = 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2));
|
||||
float Ux = ((x1 * x1 + y1 * y1) * (y2 - y3) + (x2 * x2 + y2 * y2) * (y3 - y1) + (x3 * x3 + y3 * y3) * (y1 - y2)) / D;
|
||||
|
||||
// 외심의 y좌표 계산
|
||||
float Uy = ((x1 * x1 + y1 * y1) * (x3 - x2) + (x2 * x2 + y2 * y2) * (x1 - x3) + (x3 * x3 + y3 * y3) * (x2 - x1)) / D;
|
||||
|
||||
return new Vector3(Ux, 0f, Uy);
|
||||
}
|
||||
|
||||
//외심점을 바탕으로 두 점 사이의 각도를 구하는 함수
|
||||
public static float CalculateAngleBetweenPoints(Vector3 center, Vector3 pointA, Vector3 pointB)
|
||||
{
|
||||
Vector3 vectorA = pointA - center;
|
||||
Vector3 vectorB = pointB - center;
|
||||
|
||||
float dotProduct = Vector3.Dot(vectorA.normalized, vectorB.normalized);
|
||||
float angle = Mathf.Acos(dotProduct) * Mathf.Rad2Deg;
|
||||
|
||||
return angle;
|
||||
}
|
||||
*/
|
||||
|
||||
public static float GetTValueByDistance(float distance,List<float> arcLengths)
|
||||
{
|
||||
for (int i = 0; i < arcLengths.Count - 1; i++)
|
||||
{
|
||||
if (arcLengths[i] >= distance)
|
||||
return (float)i / (arcLengths.Count - 1);
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static List<float> PrecomputeArcLengths(Vector3 p0, Vector3 p1, Vector3 p2, int segments=10000)
|
||||
{
|
||||
List<float> arcLengths = new List<float>();
|
||||
float totalLength = 0.0f;
|
||||
Vector3 previousPoint = p0;
|
||||
arcLengths.Add(0.0f);
|
||||
for (int i = 1; i <= segments; i++)
|
||||
{
|
||||
float t = i / (float)segments;
|
||||
Vector3 currentPoint = GetPoint(p0,p1,p2,t);
|
||||
totalLength += Vector3.Distance(previousPoint, currentPoint);
|
||||
arcLengths.Add(totalLength);
|
||||
previousPoint = currentPoint;
|
||||
}
|
||||
|
||||
return arcLengths;
|
||||
}
|
||||
|
||||
public static float ApproximateLength(Vector3 p0, Vector3 p1, Vector3 p2, int segments=10000)
|
||||
{
|
||||
float totalLength = 0.0f;
|
||||
Vector3 previousPoint = p0;
|
||||
Vector3 currentPoint;
|
||||
|
||||
for (int i = 1; i <= segments; i++)
|
||||
{
|
||||
float t = i / (float)segments;
|
||||
currentPoint = GetPoint(p0, p1, p2, t);
|
||||
totalLength += Vector3.Distance(previousPoint, currentPoint);
|
||||
previousPoint = currentPoint;
|
||||
}
|
||||
|
||||
return totalLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd86789b2784e6849b9c5e75de04cdf2
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Burst.Intrinsics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class ChargeZone : MonoBehaviour
|
||||
{
|
||||
public float chargePerSecond;
|
||||
|
||||
AGV inAGV;
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!other.TryGetComponent(out AGV amr))
|
||||
return;
|
||||
|
||||
inAGV = amr;
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!other.TryGetComponent(out AGV amr))
|
||||
return;
|
||||
if (inAGV == null)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!other.TryGetComponent(out AGV amr))
|
||||
return;
|
||||
|
||||
inAGV = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac7bbf2eaa67a7b4ab83ad40f118a81a
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
[RequireComponent(typeof(SphereCollider))]
|
||||
public class ObstacleSensor : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
LayerMask obstacleLayer; // Àå¾Ö¹° ·¹ÀÌ¾î ¸¶½ºÅ©
|
||||
|
||||
public event Action<GameObject> onObstacleEnter;
|
||||
public event Action<GameObject> onObstacleExit;
|
||||
|
||||
public void Set(LayerMask layermask, float sensorRadius = 10f)
|
||||
{
|
||||
gameObject.GetComponent<SphereCollider>().radius= sensorRadius;
|
||||
obstacleLayer = layermask;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
int otherLayerMask = 1 << other.gameObject.layer;
|
||||
if ((obstacleLayer.value & otherLayerMask) != 0)
|
||||
{
|
||||
onObstacleEnter?.Invoke(other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
int otherLayerMask = 1 << other.gameObject.layer;
|
||||
if ((obstacleLayer.value & otherLayerMask) != 0)
|
||||
{
|
||||
onObstacleExit?.Invoke(other.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a65fe5e7ae0d6a74dbe40d269a1cb6f7
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b852722e9ac70044bbff3486cb70963e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,77 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public class BezierCurveTester: MonoBehaviour
|
||||
{
|
||||
public Transform point0; // 시작 지점
|
||||
public Transform point1; // 제어 지점
|
||||
public Transform point2; // 목표 지점
|
||||
public LayerMask obstacleLayer; // 장애물 레이어 마스크
|
||||
public float detectionRadius = 0.5f; // 감지 구의 반지름
|
||||
public float detectionInterval = 0.1f; // 감지 간격
|
||||
|
||||
void OnDrawGizmos()
|
||||
{
|
||||
if (point0 == null || point1 == null || point2 == null) return;
|
||||
|
||||
if (detectionInterval == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Gizmos.color = Color.red;
|
||||
|
||||
// 베지어 곡선을 따라 구를 그려 시각화
|
||||
for (float t = 0; t <= 1; t += detectionInterval)
|
||||
{
|
||||
Vector3 point = BezierCurve.GetPoint(point0.position, point1.position, point2.position, t);
|
||||
Gizmos.DrawWireSphere(point, detectionRadius);
|
||||
}
|
||||
|
||||
Vector3 c = BezierCurve.GetPoint(point0.position, point1.position, point2.position, 0.5f);
|
||||
|
||||
// 원의 중심점을 구하고, 원을 그린다
|
||||
Vector3 center = CalculateCircumcenter(point0.position, c, point2.position);
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawWireSphere(center, detectionRadius);
|
||||
|
||||
// 원의 반지름을 계산하고 원을 그린다
|
||||
float radius = Vector3.Distance(center, point0.position);
|
||||
DrawCircle(center, radius, 36);
|
||||
|
||||
}
|
||||
|
||||
Vector3 CalculateCircumcenter(Vector3 A, Vector3 B, Vector3 C)
|
||||
{
|
||||
// 각 점의 좌표
|
||||
float x1 = A.x, y1 = A.z;
|
||||
float x2 = B.x, y2 = B.z;
|
||||
float x3 = C.x, y3 = C.z;
|
||||
|
||||
// 외심의 x좌표 계산
|
||||
float D = 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2));
|
||||
float Ux = ((x1 * x1 + y1 * y1) * (y2 - y3) + (x2 * x2 + y2 * y2) * (y3 - y1) + (x3 * x3 + y3 * y3) * (y1 - y2)) / D;
|
||||
|
||||
// 외심의 y좌표 계산
|
||||
float Uy = ((x1 * x1 + y1 * y1) * (x3 - x2) + (x2 * x2 + y2 * y2) * (x1 - x3) + (x3 * x3 + y3 * y3) * (x2 - x1)) / D;
|
||||
|
||||
return new Vector3(Ux,0.5f, Uy);
|
||||
}
|
||||
|
||||
void DrawCircle(Vector3 center, float radius, int segments)
|
||||
{
|
||||
float angle = 0f;
|
||||
float angleStep = 360f / segments;
|
||||
|
||||
Vector3 prevPoint = center + new Vector3(Mathf.Cos(angle * Mathf.Deg2Rad), 0, Mathf.Sin(angle * Mathf.Deg2Rad)) * radius;
|
||||
|
||||
for (int i = 1; i <= segments; i++)
|
||||
{
|
||||
angle += angleStep;
|
||||
Vector3 newPoint = center + new Vector3(Mathf.Cos(angle * Mathf.Deg2Rad), 0, Mathf.Sin(angle * Mathf.Deg2Rad)) * radius;
|
||||
Gizmos.DrawLine(prevPoint, newPoint);
|
||||
prevPoint = newPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7e72a0b3c354ba4785bdc68411c2c04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
[Serializable]
|
||||
public class AMR_Class
|
||||
{
|
||||
public string type;
|
||||
public string AmrId;
|
||||
public int workstate;
|
||||
|
||||
public float moveSpeed;
|
||||
public Pose Pose;
|
||||
|
||||
public int lift_;
|
||||
public int loaded;
|
||||
public string Cmd;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Pose
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float theta;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AMR_Class_AMR
|
||||
{
|
||||
public AMR_Class_Payload payload;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AMR_Class_Payload
|
||||
{
|
||||
public List<AMR_Class_plcdata> plcdatas;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AMR_Class_plcdata
|
||||
{
|
||||
public List<AMR_Class> data;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f9de9b345b1d9e4ebf54f44d6ef63af
|
||||
@@ -1,249 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
[Serializable]
|
||||
public class ASRS_Lifter_Class
|
||||
{
|
||||
//asrs input lift
|
||||
public int ASRS_04_01_P2A_D_SKID_ON = 0;
|
||||
public int ASRS_04_01_P2A_UP_DOWN = 0;
|
||||
public int ASRS_04_01_P2A_LIFT_STATE = 0;
|
||||
public string ASRS_04_01_P2A_SKID_ID = "";
|
||||
public int ASRS_04_01_A2P_AMR_IN_COMPLETE = 0;
|
||||
public int ASRS_04_01_A2P_AMR_OUT_COMPLETE = 0;
|
||||
|
||||
//asrs output Lift
|
||||
public int ASRS_14_01_P2A_D_SKID_ON = 0;
|
||||
public int ASRS_14_01_P2A_UP_DOWN = 0;
|
||||
public int ASRS_14_01_P2A_LIFT_STATE = 0;
|
||||
public string ASRS_14_01_P2A_SKID_ID = "";
|
||||
public int ASRS_14_01_A2P_AMR_IN_COMPLETE = 0;
|
||||
public int ASRS_14_01_A2P_AMR_OUT_COMPLETE = 0;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ASRS_Lifter_Breaked_Class
|
||||
{
|
||||
public int SKID_ON = 0;
|
||||
public int UP_DOWN = 0;
|
||||
public int LIFT_STATE = 0;
|
||||
public string SKID_ID = "";
|
||||
public int AMR_IN_COMPLETE = 0;
|
||||
public int AMR_OUT_COMPLETE = 0;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ASRS_StackerCrane_Class
|
||||
{
|
||||
//asrs stacker position
|
||||
public int STK_03_20_Stacker_Position_X;
|
||||
public int STK_03_20_Stacker_Position_Y;
|
||||
public int STK_03_20_Stacker_Position_Z;
|
||||
public string STK_03_20_Stacker_SKID_ID = "";
|
||||
|
||||
public int STK_03_20_Stacker_Part_On;
|
||||
public int STK_03_20_Stacker_Warehousing_Location;
|
||||
public int STK_03_20_Stacker_Step_No;
|
||||
}
|
||||
[Serializable]
|
||||
public class ASRS_Class
|
||||
{
|
||||
//conv 01 01 trigger events
|
||||
public int CONV_01_01_P2A_D_SKID_ON;
|
||||
public int CONV_01_01_P2A_RUN_STATUS;
|
||||
|
||||
//conv 01 01 value
|
||||
//speed mm/Min
|
||||
public int CONV_01_01_P2A_SPEED;
|
||||
|
||||
//something wrong in conv 01 01
|
||||
public int CONV_01_01_P2A_EMG_STOP;
|
||||
public int CONV_01_01_P2A_Total_Error;
|
||||
|
||||
|
||||
//conv 01 02 divot conv trigger events
|
||||
//CONV_01_02_P2A
|
||||
public int CONV_01_02_P2A_UP_DOWN;
|
||||
public int CONV_01_02_P2A_LIFT_STATE;
|
||||
public int CONV_01_02_P2A_RUN_STATUS;
|
||||
public int CONV_01_02_P2A_D_SKID_ON;
|
||||
//conv 01 02 value events
|
||||
public int CONV_01_02_P2A_SPEED_CHAIN;
|
||||
|
||||
//something wrong in conv 01 02
|
||||
public int CONV_01_02_P2A_EMG_STOP;
|
||||
public int CONV_01_02_P2A_Total_Error;
|
||||
|
||||
|
||||
//conv 01 03 trigger events
|
||||
public int CONV_01_03_P2A_RUN_STATUS_IN;
|
||||
public int CONV_01_03_P2A_RUN_STATUS_OUT;
|
||||
public int CONV_01_03_P2A_G_SKID_ON;
|
||||
public int CONV_01_03_P2A_D_SKID_ON;
|
||||
|
||||
//conv 01 03 value Events;
|
||||
public int CONV_01_03_P2A_SPEED;
|
||||
|
||||
//soemthing wrong in covn 01 03
|
||||
public int CONV_01_03_P2A_EMG_STOP;
|
||||
public int CONV_01_03_P2A_Total_Error;
|
||||
|
||||
|
||||
//conv 01 04 trigger events
|
||||
public int CONV_01_04_P2A_RUN_STATUS_IN;
|
||||
public int CONV_01_04_P2A_RUN_STATUS_OUT;
|
||||
public int CONV_01_04_P2A_G_SKID_ON;
|
||||
public int CONV_01_04_P2A_D_SKID_ON;
|
||||
|
||||
//conv 01 04 value Events;
|
||||
public int CONV_01_04_P2A_SPEED;
|
||||
|
||||
//soemthing wrong in covn 01 04
|
||||
public int CONV_01_04_P2A_EMG_STOP;
|
||||
public int CONV_01_04_P2A_Total_Error;
|
||||
|
||||
|
||||
|
||||
//conv 02 01 trigger event
|
||||
public int CONV_02_01_P2A_RUN_STATUS_IN;
|
||||
public int CONV_02_01_P2A_RUN_STATUS_OUT;
|
||||
|
||||
//conv 02 01 value event
|
||||
public int CONV_02_01_P2A_SPEED_CHAIN;
|
||||
public string CONV_02_01_P2A_Bill_No;
|
||||
public int CONV_02_01_P2A_SPEPARATION_NO;
|
||||
public int CONV_02_01_P2A_D_SKID_ON;
|
||||
public int CONV_02_01_P2A_G_SKID_ON;
|
||||
|
||||
//something wrong in covn 02 01
|
||||
public int CONV_02_01_P2A_Total_Error;
|
||||
public int CONV_02_01_P2A_EMG_STOP;
|
||||
|
||||
|
||||
//conv 02 02 divot conv trigger events
|
||||
//CONV_02_02_P2A
|
||||
public int CONV_02_02_P2A_UP_DOWN;
|
||||
public int CONV_02_02_P2A_LIFT_STATE;
|
||||
public int CONV_02_02_P2A_RUN_STATUS_IN;
|
||||
public int CONV_02_02_P2A_RUN_STATUS_OUT;
|
||||
|
||||
|
||||
//conv 01 02 value events
|
||||
public int CONV_02_02_P2A_SPEED_CHAIN;
|
||||
public string CONV_02_02_P2A_Bill_No;
|
||||
public int CONV_02_02_P2A_SPEPARATION_NO;
|
||||
public int CONV_02_02_P2A_D_SKID_ON;
|
||||
public int CONV_02_02_P2A_G_SKID_ON;
|
||||
|
||||
//something wrong in conv 01 02
|
||||
public int CONV_02_02_P2A_EMG_STOP;
|
||||
public int CONV_02_02_P2A_Total_Error;
|
||||
|
||||
|
||||
public int CONV_02_03_P2A_D_SKID_ON;
|
||||
public int CONV_02_03_P2A_G_SKID_ON;
|
||||
|
||||
//conv 02 03 out conv trigger events
|
||||
public int CONV_02_03_P2A_RUN_STATUS_IN;
|
||||
public int CONV_02_03_P2A_RUN_STATUS_OUT;
|
||||
|
||||
//conv 02 03 value events
|
||||
public int CONV_02_03_P2A_SPEED;
|
||||
public string CONV_02_03_P2A_Bill_No;
|
||||
public int CONV_02_03_P2A_SPEPARATION_NO;
|
||||
|
||||
//something wrong in conv 02 03
|
||||
public int CONV_02_03_P2A_EMG_STOP;
|
||||
public int CONV_02_03_P2A_Total_Error;
|
||||
|
||||
//asrs stacker position
|
||||
public int Stacker_Position_X;
|
||||
public int Stacker_Position_Y;
|
||||
public int Stacker_Position_Z;
|
||||
|
||||
public int Stacker_Part_On;
|
||||
|
||||
#nullable enable
|
||||
//asrs rack status
|
||||
public int STK_03_01_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_01_P2A_Bill_No;
|
||||
public string? STK_03_01_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_02_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_02_P2A_Bill_No;
|
||||
public string? STK_03_02_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_03_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_03_P2A_Bill_No;
|
||||
public string? STK_03_03_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_04_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_04_P2A_Bill_No;
|
||||
public string? STK_03_04_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_05_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_05_P2A_Bill_No;
|
||||
public string? STK_03_05_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_06_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_06_P2A_Bill_No;
|
||||
public string? STK_03_06_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_07_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_07_P2A_Bill_No;
|
||||
public string? STK_03_07_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_08_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_08_P2A_Bill_No;
|
||||
public string? STK_03_08_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_09_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_09_P2A_Bill_No;
|
||||
public string? STK_03_09_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_10_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_10_P2A_Bill_No;
|
||||
public string? STK_03_10_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_11_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_11_P2A_Bill_No;
|
||||
public string? STK_03_11_P2A_SEPARATION_NO;
|
||||
|
||||
public int STK_03_12_P2A_CARGO_ARRIVED;
|
||||
public string? STK_03_12_P2A_Bill_No;
|
||||
public string? STK_03_12_P2A_SEPARATION_NO;
|
||||
|
||||
#nullable disable
|
||||
public string ASRS_01_01_P2A_Bill_No;
|
||||
public string ASRS_01_01_P2A_SEPARATION_NO;
|
||||
|
||||
public string ASRS_02_01_P2A_Bill_No;
|
||||
public string ASRS_02_01_P2A_SEPARATION_NO;
|
||||
|
||||
|
||||
|
||||
public string SUPPLY_01_01_P2A_Bill_No;
|
||||
public string SUPPLY_01_01_P2A_SEPARATION_NO;
|
||||
public int SUPPLY_01_01_P2A_G_SKID_ON;
|
||||
public int SUPPLY_01_01_P2A_D_SKID_ON;
|
||||
|
||||
public string SUPPLY_01_02_P2A_Bill_No;
|
||||
public string SUPPLY_01_02_P2A_SEPARATION_NO;
|
||||
public int SUPPLY_01_02_P2A_G_SKID_ON;
|
||||
public int SUPPLY_01_02_P2A_D_SKID_ON;
|
||||
|
||||
public string SUPPLY_01_03_P2A_Bill_No;
|
||||
public string SUPPLY_01_03_P2A_SEPARATION_NO;
|
||||
public int SUPPLY_01_03_P2A_G_SKID_ON;
|
||||
public int SUPPLY_01_03_P2A_D_SKID_ON;
|
||||
|
||||
public string SUPPLY_01_04_P2A_Bill_No;
|
||||
public string SUPPLY_01_04_P2A_SEPARATION_NO;
|
||||
public int SUPPLY_01_04_P2A_G_SKID_ON;
|
||||
public int SUPPLY_01_04_P2A_D_SKID_ON;
|
||||
|
||||
public string DataTime;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81cbb5803ff36ea439d8e597148ef460
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
[Serializable]
|
||||
public class COBOT_Class
|
||||
{
|
||||
public string id;
|
||||
public string time;
|
||||
public string subject;
|
||||
public Payload payload;
|
||||
|
||||
public class Payload
|
||||
{
|
||||
public List<PlcData> plcDatas;
|
||||
public int error;
|
||||
public int result;
|
||||
public string producer;
|
||||
public string plc;
|
||||
}
|
||||
|
||||
public class PlcData
|
||||
{
|
||||
public string plcsc;
|
||||
public List<Data> data;
|
||||
public int error;
|
||||
public int result;
|
||||
public string producer;
|
||||
public string plc;
|
||||
}
|
||||
|
||||
public class Data
|
||||
{
|
||||
public string tag;
|
||||
public string val;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3a2ab02a3c137046ad65f4028294197
|
||||
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class DataDistributer : MonoBehaviour
|
||||
{
|
||||
public event Action<string> onAMRDestinationDataReceived;
|
||||
public event Action<string,ASRS_Lifter_Class> onLifterDataReceived;
|
||||
public event Action<string,ASRS_StackerCrane_Class> onStackerDataReceived;
|
||||
public event Action<string,ASRS_Class> onASRSDataReceived;
|
||||
public event Action<string,Supplier_Class> onSupplierDataReceived;
|
||||
public event Action<string,COBOT_Class> onCobotDataReceived;
|
||||
public event Action<string,AMR_Class> onAMRDataReceived;
|
||||
|
||||
void Start()
|
||||
{
|
||||
FindAnyObjectByType<DataReader>().onMessageReceived += DataDistribute;
|
||||
}
|
||||
|
||||
public void DataDistribute(string topic, string data)
|
||||
{
|
||||
AMR_Class amr;
|
||||
ASRS_Lifter_Class lifter;
|
||||
ASRS_StackerCrane_Class stacker;
|
||||
ASRS_Class asrs;
|
||||
Supplier_Class supplier;
|
||||
COBOT_Class cobot;
|
||||
switch (topic)
|
||||
{
|
||||
case "amr":
|
||||
onAMRDestinationDataReceived?.Invoke(data);
|
||||
break;
|
||||
case "lifter":
|
||||
lifter = JsonConvert.DeserializeObject<ASRS_Lifter_Class>(data);
|
||||
onLifterDataReceived?.Invoke(topic, lifter);
|
||||
break;
|
||||
case "stacker":
|
||||
stacker = JsonConvert.DeserializeObject<ASRS_StackerCrane_Class>(data);
|
||||
onStackerDataReceived?.Invoke(topic, stacker);
|
||||
break;
|
||||
case "cargo":
|
||||
asrs = JsonConvert.DeserializeObject<ASRS_Class>(data);
|
||||
onASRSDataReceived?.Invoke(topic, asrs);
|
||||
break;
|
||||
case "supplier":
|
||||
supplier = JsonConvert.DeserializeObject<Supplier_Class>(data);
|
||||
onSupplierDataReceived?.Invoke(topic, supplier);
|
||||
break;
|
||||
case "H-ACS.PLC-SC_Cobot_Opc1":
|
||||
cobot = JsonConvert.DeserializeObject<COBOT_Class>(data);
|
||||
onCobotDataReceived?.Invoke(topic, cobot);
|
||||
break;
|
||||
case "H-ACS.PLC-SC_Cobot_Opc2":
|
||||
cobot = JsonConvert.DeserializeObject<COBOT_Class>(data);
|
||||
onCobotDataReceived?.Invoke(topic, cobot);
|
||||
break;
|
||||
case "H-ACS.PLC-SC_Cobot_Opc3":
|
||||
cobot = JsonConvert.DeserializeObject<COBOT_Class>(data);
|
||||
onCobotDataReceived?.Invoke(topic, cobot);
|
||||
break;
|
||||
case "H-ACS.PLC-SC_Cobot_Opc4":
|
||||
cobot = JsonConvert.DeserializeObject<COBOT_Class>(data);
|
||||
onCobotDataReceived?.Invoke(topic, cobot);
|
||||
break;
|
||||
case "R_137.ACS":
|
||||
amr = JsonConvert.DeserializeObject<AMR_Class>(data);
|
||||
onAMRDataReceived?.Invoke(topic, amr);
|
||||
break;
|
||||
case "R_147.ACS":
|
||||
amr = JsonConvert.DeserializeObject<AMR_Class>(data);
|
||||
onAMRDataReceived?.Invoke(topic, amr);
|
||||
break;
|
||||
case "R_153.ACS":
|
||||
amr = JsonConvert.DeserializeObject<AMR_Class>(data);
|
||||
onAMRDataReceived?.Invoke(topic, amr);
|
||||
break;
|
||||
case "R_156.ACS":
|
||||
amr = JsonConvert.DeserializeObject<AMR_Class>(data);
|
||||
onAMRDataReceived?.Invoke(topic, amr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdf7eb60acc70744fa966e88090c0ff8
|
||||
@@ -1,90 +0,0 @@
|
||||
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine.SceneManagement;
|
||||
using TMPro;
|
||||
|
||||
|
||||
public class DataReader : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
string separator = "@";
|
||||
|
||||
TextAsset csvFile;
|
||||
public event Action<string, string> onMessageReceived;
|
||||
|
||||
[SerializeField]
|
||||
TimeSpan prevTime = new TimeSpan();
|
||||
[SerializeField]
|
||||
TimeSpan nowTime = new TimeSpan();
|
||||
public string[] datas;
|
||||
|
||||
[SerializeField]
|
||||
TMP_Text ReplayTimer;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//ReplayTimer.gameObject.SetActive(true);
|
||||
// Resources 폴더에서 파일을 불러옵니다.
|
||||
csvFile = Resources.Load<TextAsset>($"LogData/DataLog");
|
||||
|
||||
if (csvFile != null)
|
||||
{
|
||||
//Debug.Log($"DataArchitect: {csvFile.text}");
|
||||
StartCoroutine(GenerateDataFromCSV(csvFile.text,parseTime(PlayerPrefs.GetInt("Minute"),PlayerPrefs.GetInt("Second"))));
|
||||
PlayerPrefs.SetInt("Minute", 0);
|
||||
PlayerPrefs.SetInt("Second", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("CSV 파일을 찾을 수 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTimer(int minute,int second)
|
||||
{
|
||||
PlayerPrefs.SetInt("Minute", minute);
|
||||
PlayerPrefs.SetInt("Second", second);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
TimeSpan parseTime(int minute,int second)
|
||||
{
|
||||
return new TimeSpan(0, 0, minute, second, 0);
|
||||
}
|
||||
|
||||
IEnumerator GenerateDataFromCSV(string csvContent,TimeSpan startTime)
|
||||
{
|
||||
prevTime = new TimeSpan();
|
||||
nowTime = new TimeSpan();
|
||||
string[] lines = csvContent.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
datas = line.Split(separator);
|
||||
if (nowTime < startTime)
|
||||
{
|
||||
TimeSpan.TryParse(datas[0], out nowTime);
|
||||
prevTime = nowTime;
|
||||
continue;
|
||||
}
|
||||
if (prevTime == null)
|
||||
{
|
||||
Debug.Log("setprev");
|
||||
yield return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeSpan.TryParse(datas[0], out nowTime);
|
||||
yield return new WaitForSeconds((float)(nowTime - prevTime).TotalSeconds);
|
||||
}
|
||||
if (nowTime != null)
|
||||
{
|
||||
//ReplayTimer.text = nowTime.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
onMessageReceived?.Invoke(datas[1], datas[2]);
|
||||
prevTime = nowTime;
|
||||
}
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33a032a155f67b6468082f3e1e69fd53
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b981ed8ac128e14093408177be02de2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
[Serializable]
|
||||
public class Supplier_Class
|
||||
{
|
||||
public int SUPPLY_06_01_A2P_AMR_IN_COMPLETE;
|
||||
public int SUPPLY_06_01_P2A_D_SKID_ON;
|
||||
public string SUPPLY_06_01_P2A_SKID_ID;
|
||||
|
||||
public int SUPPLY_06_02_A2P_AMR_IN_COMPLETE;
|
||||
public int SUPPLY_06_02_P2A_D_SKID_ON;
|
||||
public string SUPPLY_06_02_P2A_SKID_ID;
|
||||
|
||||
public int SUPPLY_06_03_A2P_AMR_IN_COMPLETE;
|
||||
public int SUPPLY_06_03_P2A_D_SKID_ON;
|
||||
public string SUPPLY_06_03_P2A_SKID_ID;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Supplier_Breaked_Class
|
||||
{
|
||||
public int AMR_IN_COMPLETE;
|
||||
public int SKID_ON;
|
||||
public string SKID_ID;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b80dffaa75a699c408270dba8c900d05
|
||||
@@ -21,10 +21,6 @@ namespace Studio.Manage
|
||||
Join(new InterferedObjectManager());
|
||||
Join(new CursorManager());
|
||||
Join(new CameraManager());
|
||||
Join(new AGVNodeManager());
|
||||
Join(new NodeGizmoController());
|
||||
Join(new AGVNodeLinkManager());
|
||||
Join(new AGVManager());
|
||||
Join(new AssetManager());
|
||||
Join(new SceneStartSettingManager());
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using UnityEngine;
|
||||
using Studio.Attributes;
|
||||
using Studio.UI;
|
||||
using Studio.Core;
|
||||
using Studio.Interfaces;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using Studio.Test;
|
||||
|
||||
namespace Studio.UI
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Studio.Test;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b838f7322de76041baefa8bf3ed1da4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8b027c8fdf97884399acaa169b9140a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 753 B |
@@ -1,117 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f999aa22a12775346bb5f1edd872f035
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 269 B |
@@ -1,117 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09de9b707acf1234584cfca3a6fb133e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
@@ -1,117 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f03871f0457b28941864ab61d945cf0d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public class AGVLift : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fb7059a769257346badd43882bceb27
|
||||
@@ -1,119 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XRLib;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVMap : MonoBehaviour, ISingle
|
||||
{
|
||||
public List<AGVNode> nodes = new();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void OnDrawGizmos()
|
||||
{
|
||||
HashSet<(Vector3, Vector3)> drawnLines = new HashSet<(Vector3, Vector3)>();
|
||||
|
||||
foreach (var n in nodes)
|
||||
{
|
||||
if (n == null)
|
||||
continue;
|
||||
Handles.Label(n.transform.position + Vector3.up * 0.5f, n.name);
|
||||
foreach (var l in n.linkedNodes)
|
||||
{
|
||||
Vector3 start = n.transform.position;
|
||||
if (l == null)
|
||||
continue;
|
||||
Vector3 end = l.transform.position;
|
||||
|
||||
// Ensure the line is always stored in a consistent order
|
||||
var line = start.x < end.x || (start.x == end.x && start.y < end.y) || (start.x == end.x && start.y == end.y && start.z < end.z)
|
||||
? (start, end)
|
||||
: (end, start);
|
||||
|
||||
if (!drawnLines.Contains(line))
|
||||
{
|
||||
Gizmos.DrawLine(start, end);
|
||||
drawnLines.Add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
public List<AGVPortNode> GetPortNodes()
|
||||
{
|
||||
var result = new List<AGVPortNode>();
|
||||
foreach(var n in nodes)
|
||||
{
|
||||
if (n is AGVPortNode pn)
|
||||
{
|
||||
result.Add(pn);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool TryGetEmptyInputPortNode(out AGVPortNode portNode)
|
||||
{
|
||||
foreach (var n in nodes)
|
||||
{
|
||||
if (n is not AGVPortNode pn)
|
||||
continue;
|
||||
|
||||
if (pn.portType != AGVPortNode.PortType.Input)
|
||||
continue;
|
||||
|
||||
if (pn.loader is not InputPort)
|
||||
continue;
|
||||
|
||||
Debug.Log($"TryGetEmptyInputPortNode: {pn.name}");
|
||||
if (pn.loader.isEmpty)
|
||||
{
|
||||
portNode = pn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
portNode = null;
|
||||
return false;
|
||||
}
|
||||
internal List<AGVNode> FindPath(AGVNode startNode, AGVNode targetNode)
|
||||
{
|
||||
var visited = new HashSet<AGVNode>();
|
||||
var path = new List<AGVNode>();
|
||||
if (DFS(startNode, targetNode, visited, path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
return null; // °æ·Î¸¦ ãÀ» ¼ö ¾øÀ½
|
||||
}
|
||||
|
||||
private bool DFS(AGVNode current, AGVNode target, HashSet<AGVNode> visited, List<AGVNode> path)
|
||||
{
|
||||
visited.Add(current);
|
||||
path.Add(current);
|
||||
|
||||
if (current == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var neighbor in current.linkedNodes)
|
||||
{
|
||||
if (neighbor == null || visited.Contains(neighbor))
|
||||
continue;
|
||||
|
||||
if (DFS(neighbor, target, visited, path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
path.RemoveAt(path.Count - 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cf7c70fe6f038949a6c633a6e9748bd
|
||||
@@ -1,65 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Studio.Test;
|
||||
|
||||
namespace Studio.EditorUtil
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[CustomEditor(typeof(AGVMap))]
|
||||
public class AGVMapEditor : Editor
|
||||
{
|
||||
AGVMap map;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
map = (AGVMap)target;
|
||||
|
||||
if(GUILayout.Button("Auto Indexing"))
|
||||
{
|
||||
AutoIndexing();
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoIndexing()
|
||||
{
|
||||
LoadNodes();
|
||||
for (int i = 0; i < map.nodes.Count; i++)
|
||||
{
|
||||
var node = map.nodes[i];
|
||||
node.entity = new AGVNodeEntity();
|
||||
var entity = node.entity as AGVNodeEntity;
|
||||
entity.id = i.ToString();
|
||||
|
||||
map.nodes[i].gameObject.name = node.entity.id;
|
||||
}
|
||||
|
||||
for (int i = 0; i < map.nodes.Count; i++)
|
||||
{
|
||||
var node = map.nodes[i];
|
||||
var entity = node.entity as AGVNodeEntity;
|
||||
entity.linkedNodeIDs.Clear();
|
||||
foreach (var linkedNode in node.linkedNodes)
|
||||
{
|
||||
entity.linkedNodeIDs.Add(linkedNode.entity.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadNodes()
|
||||
{
|
||||
map.nodes.Clear();
|
||||
foreach (Transform child in map.transform)
|
||||
{
|
||||
AGVNode node = child.GetComponent<AGVNode>();
|
||||
if (node != null)
|
||||
{
|
||||
map.nodes.Add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af2e4a4e1cbe75479a59bbb023fa8d5
|
||||
@@ -1,30 +0,0 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using Studio.Manage;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVNeedsScanner : NeedsScanner
|
||||
{
|
||||
private readonly VirtualFactoryManager vfManager;
|
||||
AGVManager manager;
|
||||
public AGVNeedsScanner(VirtualFactoryManager vfManager, AGVManager agvManager)
|
||||
{
|
||||
this.vfManager = vfManager;
|
||||
manager = agvManager;
|
||||
}
|
||||
|
||||
public override void Scanning()
|
||||
{
|
||||
CheckAGVCount();
|
||||
ScanningComplete();
|
||||
}
|
||||
void CheckAGVCount()
|
||||
{
|
||||
if (manager.agvs.Count < vfManager.maxAGVCount)
|
||||
{
|
||||
needs.Add(FactoryNeeds.GenerateAGV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 467b71fac96c5774c8c7f08ac58f9496
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1571c16d54881b479204928d1fd0cdf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVNode : TwinObject
|
||||
{
|
||||
public List<AGVNode> linkedNodes = new();
|
||||
public bool reserved;
|
||||
public Transform nextConveyor;
|
||||
|
||||
#region legacy
|
||||
public AGVNodeClass nodeClass;
|
||||
MaterialPropertyBlock mpb;
|
||||
List<Renderer> meshRendererList = new List<Renderer>();
|
||||
public GameObject loadSocket;
|
||||
public GameObject unLoadSocket;
|
||||
#endregion
|
||||
|
||||
public void Initialize(AGVNodeClass data)
|
||||
{
|
||||
nodeClass = data;
|
||||
|
||||
mpb = new MaterialPropertyBlock();
|
||||
var allChildren = gameObject.GetComponentsInChildren<Transform>(true);
|
||||
|
||||
foreach (var child in allChildren)
|
||||
{
|
||||
if (child.gameObject.GetComponent<Renderer>() != null)
|
||||
{
|
||||
meshRendererList.Add(child.gameObject.GetComponent<Renderer>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
foreach (var r in meshRendererList)
|
||||
{
|
||||
mpb.SetColor("_BaseColor", color);
|
||||
mpb.SetColor("baseColorFactor", color);
|
||||
r.SetPropertyBlock(mpb);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteColor()
|
||||
{
|
||||
foreach (var r in meshRendererList)
|
||||
{
|
||||
r.SetPropertyBlock(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d1092f586cc6e34e991814d701c66ce
|
||||
@@ -1,25 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class AGVNodeClass
|
||||
{
|
||||
public string id="0";
|
||||
public string x="0";
|
||||
public string y="0";
|
||||
public string z="0";
|
||||
|
||||
public List<string> linkedNodID=new List<string>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class AGVNodeMap
|
||||
{
|
||||
public string maxid="0";
|
||||
public List<AGVNodeClass> agvNodeData=new List<AGVNodeClass>();
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb7496b312b6b9b44a1f929ec92c5cba
|
||||
@@ -1,21 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using Studio.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
[Serializable]
|
||||
public class AGVNodeEntity : IEntity
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
public List<string> linkedNodeIDs = new();
|
||||
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53ef4d7a0b059254bae23ffee5d0aabf
|
||||
@@ -1,117 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Studio.Test;
|
||||
|
||||
namespace Studio.Manage
|
||||
{
|
||||
public class AGVNodeLinkManager : Manager
|
||||
{
|
||||
public HashSet<Pair<AGVNode>> linkedNode = new HashSet<Pair<AGVNode>>();
|
||||
private Dictionary<Pair<AGVNode>, GameObject> lineObjects = new Dictionary<Pair<AGVNode>, GameObject>();
|
||||
|
||||
[SerializeField]
|
||||
float lineWidth = 0.1f;
|
||||
[SerializeField]
|
||||
Material lineMat;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddLines(List<AGVNode> nodeList)
|
||||
{
|
||||
for (int i = 0; i < nodeList.Count; i++)
|
||||
{
|
||||
if (i < nodeList.Count-1)
|
||||
{
|
||||
AddLine(nodeList[i], nodeList[i + 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLine(nodeList[i], nodeList[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddLine(AGVNode item1, AGVNode item2)
|
||||
{
|
||||
var pair = new Pair<AGVNode>(item1, item2);
|
||||
if (linkedNode.Contains(pair))
|
||||
{
|
||||
return;
|
||||
}
|
||||
linkedNode.Add(pair);
|
||||
DrawLine(pair);
|
||||
}
|
||||
|
||||
public void UpdateLine(AGVNode item1, AGVNode item2)
|
||||
{
|
||||
var pair = new Pair<AGVNode>(item1, item2);
|
||||
|
||||
if (linkedNode.Contains(pair))
|
||||
{
|
||||
UpdateLineRender(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("nopair");
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveLine(AGVNode item1, AGVNode item2)
|
||||
{
|
||||
var pair = new Pair<AGVNode>(item1, item2);
|
||||
|
||||
if (linkedNode.Contains(pair))
|
||||
{
|
||||
RemoveLineRender(pair);
|
||||
linkedNode.Remove(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("nopair");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawLine(Pair<AGVNode> pair)
|
||||
{
|
||||
GameObject lineObject = new GameObject($"{pair.Item1.name + pair.Item2.name}link");
|
||||
LineRenderer lineRenderer = lineObject.AddComponent<LineRenderer>();
|
||||
|
||||
lineRenderer.material = lineMat;
|
||||
lineRenderer.startWidth = lineWidth;
|
||||
lineRenderer.endWidth = lineWidth;
|
||||
lineRenderer.positionCount = 2;
|
||||
lineRenderer.useWorldSpace = true;
|
||||
|
||||
lineRenderer.SetPosition(0, pair.Item1.transform.position);
|
||||
lineRenderer.SetPosition(1, pair.Item2.transform.position);
|
||||
|
||||
lineObjects.Add(pair, lineObject);
|
||||
}
|
||||
|
||||
public void UpdateLineRender(Pair<AGVNode> pair)
|
||||
{
|
||||
if (lineObjects.ContainsKey(pair))
|
||||
{
|
||||
LineRenderer line = lineObjects[pair].GetComponent<LineRenderer>();
|
||||
line.SetPosition(0, pair.Item1.transform.position);
|
||||
line.SetPosition(1, pair.Item2.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveLineRender(Pair<AGVNode> pair)
|
||||
{
|
||||
if (lineObjects.ContainsKey(pair))
|
||||
{
|
||||
Object.Destroy(lineObjects[pair]);
|
||||
lineObjects.Remove(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 205c8d7211f5982419864d3c1e0ce728
|
||||
@@ -1,442 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TriLibCore.SFB;
|
||||
using UnityEngine;
|
||||
using XRLib;
|
||||
using Studio.Interfaces;
|
||||
using Studio.Test;
|
||||
using Studio.AssetTool;
|
||||
using Object = UnityEngine.Object;
|
||||
using static Studio.Enums;
|
||||
|
||||
namespace Studio.Manage
|
||||
{
|
||||
|
||||
public class AGVNodeManager : Manager, IModeController, IInputHandler
|
||||
{
|
||||
[SerializeField]
|
||||
GameObject nodePrefab;
|
||||
|
||||
[SerializeField]
|
||||
GameObject markerPrefab;
|
||||
GameObject nodeTarget;
|
||||
|
||||
NodeSelectMode nodeSelectMode = NodeSelectMode.Idle;
|
||||
|
||||
public event Action<AGVNode, AGVNode> onNodeConnectionAdded;
|
||||
public event Action<AGVNode, AGVNode> onNodeConnectionUpdated;
|
||||
public event Action<AGVNode, AGVNode> onNodeConnectionRemoved;
|
||||
|
||||
public AGVNode currentlySelectedNode;
|
||||
|
||||
public event Action<GameObject> onNodeGizmoSelected;
|
||||
public event Action<GameObject> onNodeSettingSelected;
|
||||
public event Action onNodeDeselected;
|
||||
public event Action<List<AGVNode>> onNodeSequenceUpdated;
|
||||
public event Action<List<AGVNode>> onNodeSequenceOrdered;
|
||||
|
||||
public AGVNodeMap agvNodeMap;
|
||||
Dictionary<string, AGVNode> nodeTable = new();
|
||||
|
||||
List<AGVNode> selectedNodeSequence = new List<AGVNode>();
|
||||
InputHandler myHandler;
|
||||
NodeGizmoController nodeGizmoController;
|
||||
UserInputManager userInputManager;
|
||||
Raycaster raycaster;
|
||||
|
||||
public ModePanel.ProgramMode mode => ModePanel.ProgramMode.AGVPathDrawing;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
agvNodeMap = new AGVNodeMap();
|
||||
myHandler = GetInputHandler();
|
||||
nodeGizmoController = ManagerHub.instance.Get<NodeGizmoController>();
|
||||
userInputManager = GameObject.FindAnyObjectByType<UserInputManager>();
|
||||
raycaster = GameObject.FindAnyObjectByType<Raycaster>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (currentlySelectedNode)
|
||||
{
|
||||
foreach (var c in currentlySelectedNode.nodeClass.linkedNodID)
|
||||
{
|
||||
onNodeConnectionUpdated?.Invoke(currentlySelectedNode, nodeTable[c]);
|
||||
}
|
||||
agvNodeMap.agvNodeData.Find(n => n.id == currentlySelectedNode.nodeClass.id).x = currentlySelectedNode.transform.position.x.ToString();
|
||||
agvNodeMap.agvNodeData.Find(n => n.id == currentlySelectedNode.nodeClass.id).y = currentlySelectedNode.transform.position.y.ToString();
|
||||
agvNodeMap.agvNodeData.Find(n => n.id == currentlySelectedNode.nodeClass.id).z = currentlySelectedNode.transform.position.z.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSelectMode(NodeSelectMode selectMode)
|
||||
{
|
||||
if (nodeSelectMode == selectMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
nodeSelectMode = selectMode;
|
||||
if (selectMode == NodeSelectMode.Draw)
|
||||
{
|
||||
DrawMarker(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawMarker(false);
|
||||
}
|
||||
foreach (var n in selectedNodeSequence)
|
||||
{
|
||||
n.DeleteColor();
|
||||
}
|
||||
selectedNodeSequence.Clear();
|
||||
onNodeSequenceUpdated?.Invoke(selectedNodeSequence);
|
||||
DeselectNode();
|
||||
}
|
||||
|
||||
public void OnClickAGVNode(RaycastHit hit, Component comp)
|
||||
{
|
||||
if (nodeGizmoController.GetGizmoHover()||nodeSelectMode==NodeSelectMode.Idle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var selectnode = comp.GetComponent<AGVNode>();
|
||||
if (nodeSelectMode == NodeSelectMode.SelectRunNode)
|
||||
{
|
||||
if (selectedNodeSequence.Contains(selectnode))
|
||||
{
|
||||
OrderNodeRemove(selectnode);
|
||||
}
|
||||
else
|
||||
{
|
||||
OrderNodeAdd(selectnode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectnode == currentlySelectedNode)
|
||||
{
|
||||
DeselectNode();
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectNode(selectnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectNode(AGVNode node)
|
||||
{
|
||||
currentlySelectedNode = node;
|
||||
if (nodeSelectMode == NodeSelectMode.Setting)
|
||||
{
|
||||
onNodeSettingSelected?.Invoke(currentlySelectedNode.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
onNodeGizmoSelected?.Invoke(currentlySelectedNode.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeselectNode()
|
||||
{
|
||||
onNodeDeselected?.Invoke();
|
||||
if (currentlySelectedNode)
|
||||
{
|
||||
currentlySelectedNode.DeleteColor();
|
||||
}
|
||||
currentlySelectedNode = null;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
ClearNodes();
|
||||
string json = "";
|
||||
var data = StandaloneFileBrowser.OpenFilePanel("AGV Node Dialog", "", "json", false);
|
||||
if (data.Count >= 1 && !string.IsNullOrEmpty(data[0].Name))
|
||||
{
|
||||
json = System.IO.File.ReadAllText(data[0].Name);
|
||||
try
|
||||
{
|
||||
agvNodeMap = JsonConvert.DeserializeObject<AGVNodeMap>(json);
|
||||
} catch
|
||||
{
|
||||
Debug.Log("¸Â´Â json Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù");
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
Debug.Log("File not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach (var nd in agvNodeMap.agvNodeData)
|
||||
{
|
||||
CreateNode(nd);
|
||||
}
|
||||
LoadNodeConnections();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(agvNodeMap);
|
||||
var data=StandaloneFileBrowser.SaveFilePanel("AGV Node Dialog", "", "agvnodedata", "json");
|
||||
if (!string.IsNullOrEmpty(data.Name))
|
||||
{
|
||||
FileStream f = new FileStream(data.Name, FileMode.Create, FileAccess.Write);
|
||||
|
||||
StreamWriter writer = new StreamWriter(f, System.Text.Encoding.Unicode);
|
||||
writer.Write(json);
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawMarker(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
nodeTarget = Object.Instantiate(markerPrefab);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nodeTarget)
|
||||
{
|
||||
Object.Destroy(nodeTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveDrawTarget(RaycastHit hit, Component comp)
|
||||
{
|
||||
if (nodeTarget)
|
||||
{
|
||||
nodeTarget.transform.position = hit.point;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateNode(AGVNodeClass nodedata)
|
||||
{
|
||||
if (nodeTable.ContainsKey(nodedata.id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject go = Object.Instantiate(nodePrefab);
|
||||
var objNode = go.GetComponent<AGVNode>();
|
||||
nodeTable.Add(nodedata.id, objNode);
|
||||
objNode.Initialize(nodedata);
|
||||
|
||||
var x = float.Parse(nodedata.x);
|
||||
var y = float.Parse(nodedata.y);
|
||||
var z = float.Parse(nodedata.z);
|
||||
go.transform.position = new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
void LoadNodeConnections()
|
||||
{
|
||||
foreach (var nodedata in nodeTable.Values)
|
||||
{
|
||||
foreach (var c in nodedata.nodeClass.linkedNodID)
|
||||
{
|
||||
onNodeConnectionAdded?.Invoke(nodeTable[nodedata.nodeClass.id], nodeTable[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ONClickGround(RaycastHit hit, Component comp)
|
||||
{
|
||||
if (nodeGizmoController.GetGizmoHover() || nodeSelectMode == NodeSelectMode.Idle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DeselectNode();
|
||||
if (nodeSelectMode == NodeSelectMode.Draw)
|
||||
{
|
||||
GameObject go = Object.Instantiate(nodePrefab);
|
||||
go.transform.position = hit.point;
|
||||
var objNode = go.GetComponent<AGVNode>();
|
||||
int maxid = int.Parse(agvNodeMap.maxid);
|
||||
maxid++;
|
||||
AGVNodeClass objNodeClass = new AGVNodeClass();
|
||||
objNodeClass.id = maxid.ToString();
|
||||
objNodeClass.x = hit.point.x.ToString();
|
||||
objNodeClass.y = hit.point.y.ToString();
|
||||
objNodeClass.z = hit.point.z.ToString();
|
||||
objNode.Initialize(objNodeClass);
|
||||
|
||||
agvNodeMap.maxid = maxid.ToString();
|
||||
agvNodeMap.agvNodeData.Add(objNode.nodeClass);
|
||||
nodeTable.Add(maxid.ToString(), objNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddNode()
|
||||
{
|
||||
if (!currentlySelectedNode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GameObject NewNode = Object.Instantiate(nodePrefab, currentlySelectedNode.transform.position + Vector3.right, Quaternion.identity);
|
||||
AGVNode node = NewNode.GetComponent<AGVNode>();
|
||||
int maxid = int.Parse(agvNodeMap.maxid);
|
||||
maxid++;
|
||||
agvNodeMap.maxid = maxid.ToString();
|
||||
AGVNodeClass nodeClass = new AGVNodeClass();
|
||||
nodeClass.id = maxid.ToString();
|
||||
nodeClass.x = (currentlySelectedNode.transform.position.x + 1f).ToString();
|
||||
nodeClass.y = (currentlySelectedNode.transform.position.y).ToString();
|
||||
nodeClass.z = (currentlySelectedNode.transform.position.z).ToString();
|
||||
node.Initialize(nodeClass);
|
||||
nodeTable.Add(maxid.ToString(), node);
|
||||
|
||||
currentlySelectedNode.nodeClass.linkedNodID.Add(maxid.ToString());
|
||||
node.nodeClass.linkedNodID.Add(currentlySelectedNode.nodeClass.id);
|
||||
|
||||
agvNodeMap.agvNodeData.Add(node.nodeClass);
|
||||
onNodeConnectionAdded?.Invoke(currentlySelectedNode, node);
|
||||
SelectNode(node);
|
||||
}
|
||||
|
||||
public void RemoveNode()
|
||||
{
|
||||
if (!currentlySelectedNode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var c in currentlySelectedNode.nodeClass.linkedNodID)
|
||||
{
|
||||
onNodeConnectionRemoved?.Invoke(currentlySelectedNode, nodeTable[c]);
|
||||
nodeTable[c].nodeClass.linkedNodID.Remove(currentlySelectedNode.nodeClass.id);
|
||||
}
|
||||
|
||||
agvNodeMap.agvNodeData.Remove(currentlySelectedNode.nodeClass);
|
||||
|
||||
foreach (var n in agvNodeMap.agvNodeData)
|
||||
{
|
||||
n.linkedNodID.Remove(currentlySelectedNode.nodeClass.id);
|
||||
}
|
||||
|
||||
Object.Destroy(currentlySelectedNode.gameObject);
|
||||
DeselectNode();
|
||||
}
|
||||
|
||||
public void NodeTypeChange(int index)
|
||||
{
|
||||
//if (currentlySelectedNode)
|
||||
//{
|
||||
// currentlySelectedNode.nodeClass.type = (AGVNodeType)index;
|
||||
// nodeTable[currentlySelectedNode.nodeClass.id].nodeClass.type = (AGVNodeType)index;
|
||||
// agvNodeMap.agvNodeData.Find(n => n.id == currentlySelectedNode.nodeClass.id).type = (AGVNodeType)index;
|
||||
//}
|
||||
}
|
||||
|
||||
public void RemoveNode(AGVNode node)
|
||||
{
|
||||
if (!node)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var c in node.nodeClass.linkedNodID)
|
||||
{
|
||||
onNodeConnectionRemoved?.Invoke(node, nodeTable[c]);
|
||||
nodeTable[c].nodeClass.linkedNodID.Remove(node.nodeClass.id);
|
||||
}
|
||||
|
||||
agvNodeMap.agvNodeData.Remove(node.nodeClass);
|
||||
|
||||
foreach (var n in agvNodeMap.agvNodeData)
|
||||
{
|
||||
n.linkedNodID.Remove(node.nodeClass.id);
|
||||
}
|
||||
|
||||
Object.Destroy(node.gameObject);
|
||||
DeselectNode();
|
||||
}
|
||||
|
||||
public void ClearNodes()
|
||||
{
|
||||
foreach (var n in nodeTable)
|
||||
{
|
||||
RemoveNode(n.Value);
|
||||
}
|
||||
nodeTable.Clear();
|
||||
selectedNodeSequence.Clear();
|
||||
onNodeSequenceUpdated?.Invoke(selectedNodeSequence);
|
||||
}
|
||||
|
||||
public void ordertoAGV()
|
||||
{
|
||||
if (selectedNodeSequence.Count <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
onNodeSequenceOrdered?.Invoke(selectedNodeSequence);
|
||||
}
|
||||
|
||||
public void OrderNodeAdd(AGVNode node)
|
||||
{
|
||||
if (selectedNodeSequence.Contains(node))
|
||||
{
|
||||
return;
|
||||
}
|
||||
node.SetColor(new Color(0f, 0.5f, 0f));
|
||||
selectedNodeSequence.Add(node);
|
||||
onNodeSequenceUpdated?.Invoke(selectedNodeSequence);
|
||||
}
|
||||
|
||||
public void OrderNodeRemove(AGVNode node)
|
||||
{
|
||||
if (!selectedNodeSequence.Contains(node))
|
||||
{
|
||||
return;
|
||||
}
|
||||
node.DeleteColor();
|
||||
selectedNodeSequence.Remove(node);
|
||||
onNodeSequenceUpdated?.Invoke(selectedNodeSequence);
|
||||
}
|
||||
|
||||
public void StatusEnterEvent()
|
||||
{
|
||||
userInputManager.SetHandler(myHandler);
|
||||
raycaster.AddEvent(Raycaster.EventType.FirstLeftClickOnly, typeof(AGVNode), OnClickAGVNode);
|
||||
raycaster.AddEvent(Raycaster.EventType.Stay, typeof(Map), MoveDrawTarget);
|
||||
raycaster.AddEvent(Raycaster.EventType.FirstLeftClickOnly, typeof(Map), ONClickGround);
|
||||
}
|
||||
|
||||
public void StatusExitEvent()
|
||||
{
|
||||
userInputManager.RemoveHandler(myHandler);
|
||||
raycaster.RemoveEvent(Raycaster.EventType.FirstLeftClickOnly, typeof(AGVNode), OnClickAGVNode);
|
||||
raycaster.RemoveEvent(Raycaster.EventType.Stay, typeof(Map), MoveDrawTarget);
|
||||
raycaster.RemoveEvent(Raycaster.EventType.FirstLeftClickOnly, typeof(Map), ONClickGround);
|
||||
}
|
||||
|
||||
public InputHandler GetInputHandler()
|
||||
{
|
||||
var getKeyActions = new Dictionary<KeyCode, Action>();
|
||||
var downKeyActions = new Dictionary<KeyCode, Action>();
|
||||
var upKeyActions = new Dictionary<KeyCode, Action>();
|
||||
|
||||
|
||||
getKeyActions.Add(KeyCode.Alpha1, ()=>ChangeSelectMode(NodeSelectMode.Draw));
|
||||
getKeyActions.Add(KeyCode.Alpha2, () => ChangeSelectMode(NodeSelectMode.Select));
|
||||
getKeyActions.Add(KeyCode.Alpha3, () => ChangeSelectMode(NodeSelectMode.Setting));
|
||||
getKeyActions.Add(KeyCode.Alpha4, () => ChangeSelectMode(NodeSelectMode.SelectRunNode));
|
||||
getKeyActions.Add(KeyCode.Escape, () => ChangeSelectMode(NodeSelectMode.Idle));
|
||||
|
||||
|
||||
var handler = new InputHandler(getKeyActions, downKeyActions, upKeyActions);
|
||||
return handler;
|
||||
}
|
||||
|
||||
//protected override void OnDestroy()
|
||||
//{
|
||||
// //vistaOpenFileDialog.Dispose();
|
||||
// //saveFileDialog.Dispose();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bb472437f31bb444ac3a380ebdd2f3f
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
using static Studio.Enums;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVNodeModePopup : PanelBase
|
||||
{
|
||||
ToggleGroup ToggleGroup;
|
||||
public Button Button_AGVPlay;
|
||||
public Button Button_Close;
|
||||
public Button Button_AGVNodeLoad;
|
||||
public Button Button_AGVNodeSave;
|
||||
public Toggle Toggle_AGVNodeDraw;
|
||||
public Toggle Toggle_AGVNodeSelectRunNode;
|
||||
public TMP_Text Text_SelectedAGVNode;
|
||||
|
||||
public event Action<NodeSelectMode> onAGVNodeModeChanged;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
ToggleGroup = Find<ToggleGroup>("Body");
|
||||
Button_Close.onClick.AddListener(Close);
|
||||
Toggle_AGVNodeDraw.onValueChanged.AddListener(OnAGVNodeDraw);
|
||||
Toggle_AGVNodeSelectRunNode.onValueChanged.AddListener(OnAGVNodeSelectRunNode);
|
||||
Text_SelectedAGVNode = Find<TMP_Text>(nameof(Text_SelectedAGVNode));
|
||||
SetActive(false);
|
||||
}
|
||||
public void OnAGVNodeDraw(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
onAGVNodeModeChanged?.Invoke(NodeSelectMode.Draw);
|
||||
}
|
||||
else
|
||||
{
|
||||
onAGVNodeModeChanged?.Invoke(NodeSelectMode.Idle);
|
||||
}
|
||||
}
|
||||
public void OnAGVNodeSelectRunNode(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
onAGVNodeModeChanged?.Invoke(NodeSelectMode.SelectRunNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
onAGVNodeModeChanged?.Invoke(NodeSelectMode.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTextSelectedAGVNode(List<AGVNode> agvNodes)
|
||||
{
|
||||
Text_SelectedAGVNode.text = "";
|
||||
foreach(var n in agvNodes)
|
||||
{
|
||||
Text_SelectedAGVNode.text += $"{n.nodeClass.id} ";
|
||||
}
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
SetActive(true);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
ToggleGroup.SetAllTogglesOff();
|
||||
onAGVNodeModeChanged?.Invoke(NodeSelectMode.Idle);
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eebd0d5e6e3ca49489e0c6a230e1f9ff
|
||||
@@ -1,60 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVNodePopup : PanelBase
|
||||
{
|
||||
public Button Button_Plus;
|
||||
public Button Button_Minus;
|
||||
public TMP_Dropdown DropDown_AGVNodeType;
|
||||
public GameObject target;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
var ScreenPoint = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||
bool onScreen = ScreenPoint.x > 0f && ScreenPoint.x < Screen.width && ScreenPoint.y > 0f && ScreenPoint.y < Screen.height && ScreenPoint.z > 0f;
|
||||
if (onScreen)
|
||||
{
|
||||
gameObject.GetComponent<CanvasGroup>().interactable = true;
|
||||
gameObject.GetComponent<CanvasGroup>().alpha = 1f;
|
||||
gameObject.GetComponent<RectTransform>().position = ScreenPoint + new Vector3(0, 5f, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.GetComponent<CanvasGroup>().interactable = false;
|
||||
gameObject.GetComponent<CanvasGroup>().alpha = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Popup(GameObject selectedNode)
|
||||
{
|
||||
target = selectedNode;
|
||||
gameObject.GetComponent<RectTransform>().position = Camera.main.WorldToScreenPoint(target.transform.position) + new Vector3(0, 5f, 0);
|
||||
gameObject.GetComponent<CanvasGroup>().interactable = true;
|
||||
gameObject.GetComponent<CanvasGroup>().alpha = 1f;
|
||||
//DropDown_AGVNodeType.value = (int)selectedNode.GetComponent<AGVNode>().nodeClass.type;
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Popdown()
|
||||
{
|
||||
target = null;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d46d21a1dec0ad345a5ce3b7fd4247a0
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class AGVPortNode : AGVNode
|
||||
{
|
||||
public enum PortType
|
||||
{
|
||||
Input,
|
||||
Output
|
||||
}
|
||||
public PortType portType;
|
||||
public Loader loader;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: daa06027f79476c49a6c2fab86fc4ae1
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class DestroyPort : OutputPort
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51a49aa3db137494c96cb9bf1a83989f
|
||||
@@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Core
|
||||
{
|
||||
public interface IEntity
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
public abstract string ToJson();
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffd65ff40bb5a0d459312a38aa3726e0
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class GeneratePort : OutputPort
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54f4e708da2ac8240ad1cb360aebb204
|
||||
@@ -1,9 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
//뭔가 놓고 나가는 경우
|
||||
public class InputPort : Port
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b899aa78db0b9f446a26478a44d9d5e8
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Test
|
||||
{
|
||||
public class Loader : TwinObject
|
||||
{
|
||||
public Product currentLoad;
|
||||
protected virtual Transform loadPivot => transform;
|
||||
public bool isEmpty => currentLoad == null;
|
||||
public event Action onLoadEvent;
|
||||
public event Action onUnloadEvent;
|
||||
public virtual void Load(Product load)
|
||||
{
|
||||
Debug.Log($"{name} is load");
|
||||
|
||||
load.transform.SetParent(loadPivot);
|
||||
load.transform.localPosition = Vector3.zero;
|
||||
load.LocationUpdate(this);
|
||||
|
||||
currentLoad = load;
|
||||
onLoadEvent?.Invoke();
|
||||
}
|
||||
|
||||
public virtual void Unload(Loader getter)
|
||||
{
|
||||
Debug.Log($"{name} is unload");
|
||||
if (getter != null)
|
||||
getter.Load(currentLoad);
|
||||
|
||||
currentLoad = null;
|
||||
onUnloadEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eaa66bb148b11b46acc7760a5495c63
|
||||
@@ -1,34 +0,0 @@
|
||||
using RTG;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Manage
|
||||
{
|
||||
public class NodeGizmoController : Manager
|
||||
{
|
||||
public ObjectTransformGizmo moveGizmo;
|
||||
public GameObject target;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
//moveGizmo = RTGizmosEngine.Get.CreateObjectMoveGizmo();
|
||||
//moveGizmo.Gizmo.SetEnabled(false);
|
||||
}
|
||||
|
||||
public void Attach(GameObject target)
|
||||
{
|
||||
moveGizmo.Gizmo.SetEnabled(true);
|
||||
this.target = target.gameObject;
|
||||
moveGizmo.SetTargetObject(target);
|
||||
}
|
||||
public void Detach()
|
||||
{
|
||||
moveGizmo.Gizmo.SetEnabled(false);
|
||||
target = null;
|
||||
}
|
||||
|
||||
internal bool GetGizmoHover()
|
||||
{
|
||||
return moveGizmo.Gizmo.IsHovered;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6552f9ab96d944459a5e5a6f3eb6463
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Studio.Test
|
||||
{
|
||||
//뭔가 들고 나가는 경우
|
||||
public class OutputPort : Port
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12fb04b0bfacc524ea2170a660857d7b
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user