using Assets.Zion.Scripts.Adam; using System.Collections; using System.Collections.Generic; using Umawerse.FiniteStateMachines; using UnityEngine; using UnityTemplateProjects; public class ToolsBootstrap : MonoBehaviour { private FiniteStateMachine _fsm; public GameObject circlePointPrefab; public GameObject linePointPrefab; public GameObject ployPointPrefab; public BackgroundLabel labelPrefab; public Material solidLineMaterial; public Material ployMaterial; public TapGesture tapGesture; public Camera mCamera; public SimpleCameraController simpleCameraController; public WRJManager wrjManager; public GameObject buleInstruct; public List lines = new List(); public bool isDistance = true; private void Awake() { _fsm = new FiniteStateMachine(); _fsm.AddState(new LineDrawingState(this)); _fsm.AddState(new CircleDrawingState(this)); _fsm.AddState(new PolygonDrawState(this)); //_fsm.SetState(StateName.line); } private void Start() { } /// /// 1-3D 2-2D /// /// public void SwitchSet2DMap(int state) { simpleCameraController.enabled = false; if (state == 1) { buleInstruct.SetActive(false); mCamera.transform.position = new Vector3(-118f, 163f, -409f); mCamera.transform.eulerAngles = new Vector3(23f, 0f, 0f); mCamera.orthographic = false; simpleCameraController.enabled = true; Switch2DModel(false); } else if (state == 2) { buleInstruct.SetActive(true); mCamera.transform.position = new Vector3(0, 556f, -10f); mCamera.transform.eulerAngles = new Vector3(90f, 0f, 0f); mCamera.orthographic = true; Switch2DModel(true); } else { } } public void Switch2DModel(bool isActive) { if (lines.Count == 0) return; for (int i = 0; i < lines.Count; i++) { if (lines[i].gameObject) lines[i].gameObject.SetActive(isActive); } } public void SetMove() { for (int i = 0; i < wrjManager.wRJControllers.Count; i++) { wrjManager.wRJControllers[i].isMove = true; } //wrjManager.currentWRJ.isMove = true; wrjManager.wrjMenuSetPanel.gameObject.SetActive(false); } private void Update() { _fsm.Update(); } public void SwitchState(int indexState) { switch (indexState) { case 0: _fsm.SetState(StateName.none); break; case 1: isDistance = true; _fsm.SetState(StateName.line); break; case 2: _fsm.SetState(StateName.polygon); break; case 3: _fsm.SetState(StateName.circle); break; } } public void SetWRJWayPoint() { isDistance = false; _fsm.SetState(StateName.line); SwitchSet2DMap(2); wrjManager.wrjMenuSetPanel.gameObject.SetActive(false); } /// /// 开始推演 /// public void StartDeduction() { //wrjManager.currentWRJ.isMove = true; for (int i = 0; i < wrjManager.wRJControllers.Count; i++) { wrjManager.wRJControllers[i].isMove = true; } } public void CloseMenu() { wrjManager.wrjMenuSetPanel.gameObject.SetActive(false); } }