190 lines
4.5 KiB
C#
190 lines
4.5 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.Remoting.Messaging;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityStandardAssets.Characters.FirstPerson;
|
|
|
|
public struct TaskDetail
|
|
{
|
|
public string taskName;
|
|
public string taskContent;
|
|
public bool isRandomRightAnswer;
|
|
public bool isRandomWrongAnswer;
|
|
public List<GameObject> rightAnswers;
|
|
public List<GameObject> wrongAnswers;
|
|
public GameObject blank;
|
|
public List<GameObject> blanks;
|
|
public GameObject clickObj;
|
|
public bool isClick;
|
|
}
|
|
public class GameMannage : MonoBehaviour
|
|
{
|
|
public static GameMannage instance;
|
|
|
|
//步骤索引
|
|
public int stepIndex = 0;
|
|
|
|
//物资卡车进门视角相机
|
|
public GameObject truckCamera;
|
|
|
|
//第一人称控制
|
|
public GameObject firstControl;
|
|
|
|
//物资卡车
|
|
public GameObject truck;
|
|
|
|
public GameObject truckWuzi;
|
|
|
|
//物资卡车司机
|
|
public GameObject driver;
|
|
|
|
//司机进入大厅对话面板
|
|
public GameObject chatPanel;
|
|
|
|
//仓库存储区域碰撞
|
|
public GameObject cangchuTrigger;
|
|
|
|
//仓库未上货架物资
|
|
public GameObject cangchuWuzi;
|
|
|
|
//仓库上货架物资
|
|
public GameObject cangwaiWuzi;
|
|
|
|
//业务脚本
|
|
public WorkInfoTeam info;
|
|
|
|
public Dictionary<string, List<GameObject>> allTaskMessage = new Dictionary<string, List<GameObject>>();
|
|
|
|
public Dictionary<string, TaskModel> allTasks = new Dictionary<string, TaskModel>();
|
|
|
|
public Dictionary<string, string> allData = new Dictionary<string, string>();
|
|
|
|
void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
#region 流程
|
|
|
|
//车辆进入 工厂
|
|
public void TruckInFactory()
|
|
{
|
|
//truck.GetComponent<Animator>().Play("che");
|
|
truck.GetComponent<DOTweenPath>().DOPlay();
|
|
truck.GetComponent<DOTweenAnimation>().DOPlay();
|
|
}
|
|
|
|
//车辆进入动画完成
|
|
public void TruckInFactoryComplete()
|
|
{
|
|
driver.SetActive(true);
|
|
}
|
|
|
|
//司机移动至大厅完成
|
|
public void HumanWalkingComplete()
|
|
{
|
|
DOTween.CompleteAll();
|
|
driver.SetActive(false);
|
|
|
|
ChangeScene.instance.StartFadeBlack(CameraToDating);
|
|
}
|
|
|
|
//场景转移至大厅
|
|
private void CameraToDating()
|
|
{
|
|
truckCamera.SetActive(false);
|
|
firstControl.SetActive(true);
|
|
ChangeScene.instance.StartFadeClear(StartTalking);
|
|
}
|
|
|
|
//开始对话
|
|
private void StartTalking()
|
|
{
|
|
chatPanel.SetActive(true);
|
|
chatPanel.GetComponent<ChatPanel>().ShowChatPanel();
|
|
firstControl.GetComponentInChildren<FirstControlCheck>().OpenCheckAQM();
|
|
}
|
|
|
|
//场景转移至仓库
|
|
public void CameraToCangku()
|
|
{
|
|
ChangeScene.instance.StartFadeBlack(CharacterPosChange);
|
|
}
|
|
|
|
//角色移动至仓库
|
|
private void CharacterPosChange()
|
|
{
|
|
firstControl.SetActive(false);
|
|
firstControl.transform.localPosition = new Vector3(3.18f, 0.98f, -9.69f);
|
|
firstControl.transform.localEulerAngles = new Vector3(0, 215.7f, 0);
|
|
firstControl.SetActive(true);
|
|
firstControl.GetComponent<FirstPersonController>().InitController();
|
|
truck.transform.GetChild(0).gameObject.SetActive(false);
|
|
info.ShowArticle();
|
|
ChangeScene.instance.StartFadeClear(OpenCangchuTrigger);
|
|
truckWuzi.SetActive(false);
|
|
cangwaiWuzi.gameObject.SetActive(true);
|
|
|
|
}
|
|
|
|
//打开 仓库地面碰撞检测
|
|
private void OpenCangchuTrigger()
|
|
{
|
|
cangchuTrigger.SetActive(true);
|
|
firstControl.GetComponentInChildren<FirstControlCheck>().StartCheck(cangchuTrigger,cangchuWuzi);
|
|
}
|
|
|
|
//改变物资至货架区
|
|
public void WuziChangeState()
|
|
{
|
|
cangchuTrigger.SetActive(false);
|
|
cangchuWuzi.gameObject.SetActive(true);
|
|
cangwaiWuzi.SetActive(false);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 加载所有任务 数据
|
|
public void AddTaskToDic(string key,TaskModel value)
|
|
{
|
|
if (!allTasks.ContainsKey(key))
|
|
{
|
|
allTasks.Add(key, value);
|
|
}
|
|
}
|
|
|
|
public void AddDataToDic(string key ,string value)
|
|
{
|
|
if (!allData.ContainsKey(key))
|
|
{
|
|
allData.Add(key, value);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region
|
|
#endregion
|
|
|
|
#region
|
|
#endregion
|
|
//返回上一场景
|
|
public void ReturnToExitScene()
|
|
{
|
|
SceneManager.LoadScene("Menu");
|
|
}
|
|
}
|