2020-11-07 21:20:30 +00:00
|
|
|
|
using QSB.Animation;
|
2020-11-09 21:05:50 +00:00
|
|
|
|
using QSB.EventsCore;
|
2020-11-01 12:26:09 +00:00
|
|
|
|
using QSB.Instruments.QSBCamera;
|
2020-11-03 21:33:48 +00:00
|
|
|
|
using QSB.Player;
|
2020-10-27 22:59:19 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.Instruments
|
|
|
|
|
{
|
|
|
|
|
public class InstrumentsManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static InstrumentsManager Instance;
|
2020-11-08 19:32:04 +00:00
|
|
|
|
private AnimationType _savedType;
|
2020-10-27 22:59:19 +00:00
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
gameObject.AddComponent<CameraManager>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Keypad9))
|
|
|
|
|
{
|
2020-11-03 21:18:40 +00:00
|
|
|
|
if (!QSBPlayerManager.LocalPlayer.PlayingInstrument)
|
2020-11-01 12:26:09 +00:00
|
|
|
|
{
|
2020-11-08 19:32:04 +00:00
|
|
|
|
_savedType = QSBPlayerManager.LocalPlayer.Animator.CurrentType;
|
2020-11-01 12:26:09 +00:00
|
|
|
|
CameraManager.Instance.SwitchTo3rdPerson();
|
2020-11-08 19:32:04 +00:00
|
|
|
|
SwitchToType(AnimationType.Chert);
|
2020-11-01 12:26:09 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CameraManager.Instance.SwitchTo1stPerson();
|
2020-11-08 19:32:04 +00:00
|
|
|
|
SwitchToType(_savedType);
|
2020-11-01 12:26:09 +00:00
|
|
|
|
}
|
2020-10-27 22:59:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-01 15:56:48 +00:00
|
|
|
|
|
2020-11-08 19:32:04 +00:00
|
|
|
|
public void SwitchToType(AnimationType type)
|
2020-11-01 15:56:48 +00:00
|
|
|
|
{
|
2020-11-09 21:05:50 +00:00
|
|
|
|
GlobalMessenger<uint, AnimationType>.FireEvent(EventNames.QSBChangeAnimType, QSBPlayerManager.LocalPlayerId, type);
|
2020-11-08 19:32:04 +00:00
|
|
|
|
QSBPlayerManager.LocalPlayer.Animator.SetAnimationType(type);
|
2020-11-01 15:56:48 +00:00
|
|
|
|
}
|
2020-10-27 22:59:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|