<feat> 프로그램 진입 시 로봇 모터 ON/OFF 표시
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
8
Assets/Resources/Materials.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bcb92e77bd548574f8f4b48f5fd1e3c1
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
136
Assets/Resources/Materials/Mat_Red.mat
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-8305441673117509560
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 9
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Mat_Red
|
||||||
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords: []
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Opaque
|
||||||
|
disabledShaderPasses:
|
||||||
|
- MOTIONVECTORS
|
||||||
|
m_LockedProperties:
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BaseMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _AddPrecomputedVelocity: 0
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _AlphaToMask: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BlendModePreserveSpecular: 1
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _ClearCoatMask: 0
|
||||||
|
- _ClearCoatSmoothness: 0
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailAlbedoMapScale: 1
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _DstBlendAlpha: 0
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 0
|
||||||
|
- _Glossiness: 0
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.005
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _SrcBlendAlpha: 1
|
||||||
|
- _Surface: 0
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 1, g: 0.6666667, b: 0.6666667, a: 1}
|
||||||
|
- _Color: {r: 1, g: 0.6666667, b: 0.6666667, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
|
m_AllowLocking: 1
|
||||||
8
Assets/Resources/Materials/Mat_Red.mat.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: df96bbc2c295a7d4bbb26fdeab9193dd
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -3,13 +3,15 @@ using UnityEngine;
|
|||||||
public class AppManager : MonoBehaviour
|
public class AppManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private ProgramView view;
|
[SerializeField] private ProgramView view;
|
||||||
|
[SerializeField] private RobotController robotController;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
ProgramModel model = new ProgramModel();
|
ProgramModel model = new ProgramModel();
|
||||||
|
|
||||||
ProgramPresenter presenter = new ProgramPresenter(model, view);
|
ProgramPresenter presenter = new ProgramPresenter(model, view);
|
||||||
|
|
||||||
|
presenter.RegisterControlledRobot(robotController);
|
||||||
|
|
||||||
view.DisplayProgram(null);
|
view.DisplayProgram(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ public class RobotProgram
|
|||||||
{
|
{
|
||||||
public string programId;
|
public string programId;
|
||||||
public List<Vector3> endpointPositions;
|
public List<Vector3> endpointPositions;
|
||||||
|
private bool motorState;
|
||||||
|
|
||||||
public RobotProgram(string id)
|
public RobotProgram(string id)
|
||||||
{
|
{
|
||||||
programId = id;
|
programId = id;
|
||||||
endpointPositions = new List<Vector3>();
|
endpointPositions = new List<Vector3>();
|
||||||
|
motorState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ public class ProgramPresenter
|
|||||||
{
|
{
|
||||||
private ProgramModel model;
|
private ProgramModel model;
|
||||||
private ProgramView view;
|
private ProgramView view;
|
||||||
|
private RobotController controlledRobot;
|
||||||
|
|
||||||
public ProgramPresenter(ProgramModel model, ProgramView view)
|
public ProgramPresenter(ProgramModel model, ProgramView view)
|
||||||
{
|
{
|
||||||
@@ -17,11 +18,31 @@ public class ProgramPresenter
|
|||||||
this.view.OnAddPointClicked += HandleAddPoint;
|
this.view.OnAddPointClicked += HandleAddPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterControlledRobot(RobotController robot)
|
||||||
|
{
|
||||||
|
this.controlledRobot = robot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnApplicationStart()
|
||||||
|
{
|
||||||
|
if (controlledRobot != null)
|
||||||
|
{
|
||||||
|
Debug.Log("로봇 모터를 ON 상태로 설정합니다.");
|
||||||
|
controlledRobot.SetMotorState(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("제어할 로봇이 등록되지 않았습니다");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleCreateProgram(string programId)
|
private void HandleCreateProgram(string programId)
|
||||||
{
|
{
|
||||||
if (model.CreateNewProgram(programId))
|
if (model.CreateNewProgram(programId))
|
||||||
{
|
{
|
||||||
view.DisplayProgram(model.CurrentProgram);
|
view.DisplayProgram(model.CurrentProgram);
|
||||||
|
view.HideProgramSelectPanel();
|
||||||
|
OnApplicationStart();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -40,8 +61,11 @@ public class ProgramPresenter
|
|||||||
if (model.LoadProgram(programId))
|
if (model.LoadProgram(programId))
|
||||||
{
|
{
|
||||||
view.DisplayProgram(model.CurrentProgram);
|
view.DisplayProgram(model.CurrentProgram);
|
||||||
|
view.HideProgramSelectPanel();
|
||||||
|
view.HideProgramList();
|
||||||
|
|
||||||
|
OnApplicationStart();
|
||||||
}
|
}
|
||||||
view.HideProgramList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleSaveProgram()
|
private void HandleSaveProgram()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class ProgramView : MonoBehaviour
|
|||||||
//[SerializeField] private TextMeshProUGUI endpointListText;
|
//[SerializeField] private TextMeshProUGUI endpointListText;
|
||||||
|
|
||||||
// --- 프로그램 목록 패널 ---
|
// --- 프로그램 목록 패널 ---
|
||||||
|
[SerializeField] private GameObject programSelectPanel;
|
||||||
[SerializeField] private GameObject programListPanel;
|
[SerializeField] private GameObject programListPanel;
|
||||||
[SerializeField] private Transform programButtonContent;
|
[SerializeField] private Transform programButtonContent;
|
||||||
[SerializeField] private GameObject programButtonPrefab;
|
[SerializeField] private GameObject programButtonPrefab;
|
||||||
@@ -49,6 +50,7 @@ public class ProgramView : MonoBehaviour
|
|||||||
loadIconButton.onClick.AddListener(HandleLoadIconClick);
|
loadIconButton.onClick.AddListener(HandleLoadIconClick);
|
||||||
closeProgramListButton.onClick.AddListener(HideProgramList);
|
closeProgramListButton.onClick.AddListener(HideProgramList);
|
||||||
|
|
||||||
|
programSelectPanel.SetActive(true);
|
||||||
programListPanel.SetActive(false);
|
programListPanel.SetActive(false);
|
||||||
loadProgramButton.gameObject.SetActive(false);
|
loadProgramButton.gameObject.SetActive(false);
|
||||||
programIdText.text = string.Empty;
|
programIdText.text = string.Empty;
|
||||||
@@ -86,12 +88,14 @@ public class ProgramView : MonoBehaviour
|
|||||||
|
|
||||||
public void DisplayProgram(RobotProgram program)
|
public void DisplayProgram(RobotProgram program)
|
||||||
{
|
{
|
||||||
//if (program == null)
|
if (program == null)
|
||||||
//{
|
{
|
||||||
// currentProgramIdText.text = "No Program Loaded";
|
//currentProgramIdText.text = "No Program Loaded";
|
||||||
// endpointListText.text = "";
|
//endpointListText.text = "";
|
||||||
// return;
|
Debug.Log("No Program Loaded");
|
||||||
//}
|
return;
|
||||||
|
}
|
||||||
|
Debug.Log($"연결된 프로그램: {program.programId}.job");
|
||||||
|
|
||||||
//currentProgramIdText.text = "Current: " + program.programId;
|
//currentProgramIdText.text = "Current: " + program.programId;
|
||||||
|
|
||||||
@@ -137,4 +141,9 @@ public class ProgramView : MonoBehaviour
|
|||||||
{
|
{
|
||||||
programListPanel.SetActive(false);
|
programListPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HideProgramSelectPanel()
|
||||||
|
{
|
||||||
|
programSelectPanel.SetActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||