using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class StepManager : MonoBehaviour
{
public static StepManager Instance { get; private set; }
/// 是否开始初始化步骤
public static bool isInit = true;
/// 背包穿戴人物模型
public static GameObject player_dress;
/// 穿戴人物初始旋转
public static Quaternion initRot;
/// 漫游场景移动人物模型
private GameObject player;
private async void Start()
{
Instance = this;
//await UIManager.Instance.ShowUI(WindowID.FaceBuildPanel);
await UIManager.Instance.ShowUI(WindowID.DlgLogin);
var characterRender = await YooAssetManager.Instance.LoadAsset("player_dress");
player_dress = Instantiate(characterRender);
initRot = player_dress.transform.rotation;
CharacterManager.Inst.MatchCharacterRender(player_dress.GetComponent());
}
public async void Init()
{
var characterRender = await YooAssetManager.Instance.LoadAsset("player");
var cmFreeLook = await YooAssetManager.Instance.LoadAsset("CM FreeLook1");
player = Instantiate(characterRender);
GameObject cm = Instantiate(cmFreeLook);
player.GetComponent().camera = GameObject.Find("Main Camera").transform;
cm.GetComponent().Follow = player.transform;
cm.GetComponent().LookAt = player.transform;
CharacterDataReMatch();
}
private async void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
await UIManager.Instance.ShowUI(WindowID.FaceBuildPanel);
CharacterManager.UICam.gameObject.SetActive(true);
}
}
///
/// 重新赋值当前角色的捏脸和装扮数据/重置角色旋转
///
public void CharacterDataReMatch()
{
if (player)
{
player_dress.transform.rotation= initRot;
CharacterManager.Inst.CharacterClothReMatch(player.GetComponent());
}
}
}