add more stuff

This commit is contained in:
Mister_Nebula 2020-11-01 12:26:09 +00:00
parent ce05a8ae30
commit be117ccc40
4 changed files with 27 additions and 6 deletions

View File

@ -7,6 +7,7 @@ namespace QSB.Instruments
{ {
public enum InstrumentType public enum InstrumentType
{ {
NONE,
CHERT, CHERT,
ESKER, ESKER,
FELDSPAR, FELDSPAR,

View File

@ -1,4 +1,5 @@
using QSB.Instruments.QSBCamera; using QSB.Events;
using QSB.Instruments.QSBCamera;
using UnityEngine; using UnityEngine;
namespace QSB.Instruments namespace QSB.Instruments
@ -17,7 +18,16 @@ namespace QSB.Instruments
{ {
if (Input.GetKeyDown(KeyCode.Keypad9)) if (Input.GetKeyDown(KeyCode.Keypad9))
{ {
CameraManager.Instance.ToggleViewMode(); if (!PlayerRegistry.LocalPlayer.PlayingInstrument)
{
CameraManager.Instance.SwitchTo3rdPerson();
GlobalMessenger<InstrumentType, bool>.FireEvent(EventNames.QSBPlayInstrument, InstrumentType.REIBECK, true);
}
else
{
CameraManager.Instance.SwitchTo1stPerson();
GlobalMessenger<InstrumentType, bool>.FireEvent(EventNames.QSBPlayInstrument, InstrumentType.REIBECK, false);
}
} }
} }
} }

View File

@ -34,10 +34,12 @@ namespace QSB.Instruments.QSBCamera
Vector3 localTargetPoint; Vector3 localTargetPoint;
if (Physics.Raycast(origin, transform.TransformDirection(localDirection), out RaycastHit outRay, RayLength, LayerMask.GetMask("Default"))) if (Physics.Raycast(origin, transform.TransformDirection(localDirection), out RaycastHit outRay, RayLength, LayerMask.GetMask("Default")))
{ {
// Raycast hit collider, get target from hitpoint.
localTargetPoint = transform.InverseTransformPoint(outRay.point) * PercentToMove; localTargetPoint = transform.InverseTransformPoint(outRay.point) * PercentToMove;
} }
else else
{ {
// Raycast didn't hit collider, get target from camera direction
localTargetPoint = localDirection * RayLength * PercentToMove; localTargetPoint = localDirection * RayLength * PercentToMove;
} }
var targetDistance = Vector3.Distance(origin, transform.TransformPoint(localTargetPoint)); var targetDistance = Vector3.Distance(origin, transform.TransformPoint(localTargetPoint));

View File

@ -1,4 +1,5 @@
using QSB.Animation; using QSB.Animation;
using QSB.Instruments;
using QSB.Tools; using QSB.Tools;
using QSB.TransformSync; using QSB.TransformSync;
using QSB.Utility; using QSB.Utility;
@ -10,6 +11,12 @@ namespace QSB
public class PlayerInfo public class PlayerInfo
{ {
public uint PlayerId { get; } public uint PlayerId { get; }
public string Name { get; set; }
public bool IsReady { get; set; }
public PlayerHUDMarker HudMarker { get; set; }
public State State { get; set; }
// Body Objects
public GameObject Camera { get; set; } public GameObject Camera { get; set; }
public GameObject Body { get; set; } public GameObject Body { get; set; }
@ -21,12 +28,13 @@ namespace QSB
public QSBTool Translator => GetToolByType(ToolType.Translator); public QSBTool Translator => GetToolByType(ToolType.Translator);
public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher); public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher);
public PlayerHUDMarker HudMarker { get; set; } // Conversation
public string Name { get; set; }
public bool IsReady { get; set; }
public int CurrentDialogueID { get; set; } public int CurrentDialogueID { get; set; }
public GameObject CurrentDialogueBox { get; set; } public GameObject CurrentDialogueBox { get; set; }
public State State { get; set; }
// Instruments
public InstrumentType CurrentInstrument { get; set; }
public bool PlayingInstrument => CurrentInstrument != InstrumentType.NONE;
public PlayerInfo(uint id) public PlayerInfo(uint id)
{ {