Commit aaed0372 authored by 杨泽宇's avatar 杨泽宇

更新

parent 7821a2a1
File added
This diff is collapsed.
fileFormatVersion: 2
guid: 9af5804f030164640b1c3ca0a2a1323c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: c7d0300a40be5b04f8144d136c74b967
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -16,6 +16,6 @@ public class AGVDemoV2 : MonoBehaviour ...@@ -16,6 +16,6 @@ public class AGVDemoV2 : MonoBehaviour
private void UpdatePosition() private void UpdatePosition()
{ {
AGVManager.AddMoveMsg("AGV1", manager.position); AGVManager.AddMoveMsg("AGV1", manager.position,manager.angle);
} }
} }
...@@ -17,6 +17,7 @@ public class LoginManager : MonoBehaviour ...@@ -17,6 +17,7 @@ public class LoginManager : MonoBehaviour
[Space] [Space]
[Header("获取的信息")] [Header("获取的信息")]
public Vector3 position; public Vector3 position;
public float angle;
private void Awake() private void Awake()
{ {
OnReceiveMsg.AddListener(_getData); OnReceiveMsg.AddListener(_getData);
...@@ -38,7 +39,7 @@ public class LoginManager : MonoBehaviour ...@@ -38,7 +39,7 @@ public class LoginManager : MonoBehaviour
{ {
RobotPositionData robotPositionData = (RobotPositionData)data; RobotPositionData robotPositionData = (RobotPositionData)data;
position = new Vector3(robotPositionData.data.x, robotPositionData.data.y, robotPositionData.data.h); position = new Vector3(robotPositionData.data.x, robotPositionData.data.y, robotPositionData.data.h);
Debug.Log(position); angle = robotPositionData.data.angle * Mathf.Rad2Deg;
} }
} }
...@@ -90,4 +91,5 @@ public class RobotPositionDataDetails ...@@ -90,4 +91,5 @@ public class RobotPositionDataDetails
public float x; public float x;
public float y; public float y;
public float h; public float h;
public float angle;
} }
\ No newline at end of file
...@@ -34,7 +34,15 @@ public class TouristModeController : MonoBehaviour ...@@ -34,7 +34,15 @@ public class TouristModeController : MonoBehaviour
[Space] [Space]
[Header("机器巡检设置")] [Header("机器巡检设置")]
public GameObject RobotInspection; public GameObject CameraInspection1;
public GameObject CameraInspection2;
public GameObject AGVInspection1;
public GameObject AGVInspection2;
private bool IsInspection1=true;
public GameObject Inspection1;
public GameObject Inspection2;
private float speeds = 1f; private float speeds = 1f;
private bool isPaused = true; private bool isPaused = true;
...@@ -43,9 +51,6 @@ public class TouristModeController : MonoBehaviour ...@@ -43,9 +51,6 @@ public class TouristModeController : MonoBehaviour
private AnimatorStateInfo stateInfo; private AnimatorStateInfo stateInfo;
private Animator planeAnimator; private Animator planeAnimator;
public bool IsArtificial = false;
private void Start() private void Start()
{ {
ResetBtn.onClick.AddListener(Restart); ResetBtn.onClick.AddListener(Restart);
...@@ -62,6 +67,7 @@ public class TouristModeController : MonoBehaviour ...@@ -62,6 +67,7 @@ public class TouristModeController : MonoBehaviour
planeAnimator.speed = 0; planeAnimator.speed = 0;
} }
private void OnDestroy() private void OnDestroy()
{ {
slider.onValueChanged.RemoveAllListeners(); slider.onValueChanged.RemoveAllListeners();
...@@ -85,14 +91,34 @@ public class TouristModeController : MonoBehaviour ...@@ -85,14 +91,34 @@ public class TouristModeController : MonoBehaviour
} }
} }
public void LinhasComutadoras()
{
if (IsInspection1)
{
Inspection1.SetActive(false);
AGVInspection1.SetActive(false);
Inspection2.SetActive(true);
AGVInspection2.SetActive(true);
}
else
{
Inspection1.SetActive(true);
AGVInspection1.SetActive(true);
Inspection2.SetActive(false);
AGVInspection2.SetActive(false);
}
IsInspection1 = !IsInspection1;
}
/// <summary> /// <summary>
/// 设置机器巡检 /// 设置机器巡检
/// </summary> /// </summary>
public void SetArtificial() public void SetArtificial()
{ {
ExitObserve(); ExitObserve();
RobotInspection.SetActive(true); CameraInspection1.SetActive(true);
IsArtificial = true; CameraInspection2.SetActive(true);
CharacterModeUI.SetActive(false); CharacterModeUI.SetActive(false);
ReturnUI.SetActive(true); ReturnUI.SetActive(true);
} }
...@@ -213,8 +239,8 @@ public class TouristModeController : MonoBehaviour ...@@ -213,8 +239,8 @@ public class TouristModeController : MonoBehaviour
Player.BackToInitPosition(); Player.BackToInitPosition();
Player.IsPause = false; Player.IsPause = false;
Player.AutoRotate = false; Player.AutoRotate = false;
RobotInspection.SetActive(false); CameraInspection1.SetActive(false);
IsArtificial = false; CameraInspection2.SetActive(false);
CharacterModeUI.SetActive(true); CharacterModeUI.SetActive(true);
ReturnUI.SetActive(false); ReturnUI.SetActive(false);
} }
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 用来把生成的摄像头,赋值到控制器上
/// </summary>
public class TouristModeInitializer : MonoBehaviour
{
public bool IsRobotInspection1;
public GameObject CameraInspection;
// Start is called before the first frame update
void Start()
{
// 查找带有TouristModeController脚本的对象
TouristModeController touristModeController = FindObjectOfType<TouristModeController>();
// 检查是否找到该对象
if (touristModeController != null)
{
if (IsRobotInspection1)
{
touristModeController.CameraInspection1 = CameraInspection;
touristModeController.AGVInspection1 = this.gameObject;
}
else
{
touristModeController.CameraInspection2 = CameraInspection;
touristModeController.AGVInspection2 = this.gameObject;
this.gameObject.SetActive(false);
}
}
}
}
fileFormatVersion: 2
guid: 195b7d9adb9c43143aa22d4e3ed051f7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment