-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndicatorManager.cs
More file actions
61 lines (60 loc) · 2.14 KB
/
Copy pathIndicatorManager.cs
File metadata and controls
61 lines (60 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using UnityEngine;
using UnityEngine.Animations;
namespace GravityIndicator
{
internal class IndicatorManager : UnityEngine.MonoBehaviour
{
internal static GameObject gravityIndicator;
internal static MeshRenderer indicatorMesh;
internal static bool Created = false;
internal static bool IndicatorEnabled = true;
void Awake()
{
Assembler.AssembleIndicator();
}
void Update()
{
if (Created && gravityIndicator != null && indicatorMesh != null)
{
if (PLServer.Instance == null)
{
if (indicatorMesh.enabled)
{
indicatorMesh.enabled = false;
}
return;
}
if (PLInput.Instance.GetButtonDown("gravIndicator"))
{
IndicatorEnabled = !IndicatorEnabled;
}
if (IndicatorEnabled)
{
indicatorMesh.enabled = IndicatorEnabled && (PLUIOutsideWorldUI.Instance.pilotingHUDActive || (GUI.EnabledInSensorDish && PLCameraSystem.Instance.GetModeString() == "SensorDish"));
if (GUI.ElementMode == 1)
{
PLPawn pawn = PLNetworkManager.Instance.ViewedPawn;
if (pawn != null && pawn.CurrentShip != null)
{
Transform ship = pawn.CurrentShip.Exterior.transform;
gravityIndicator.transform.position = ship.position +
ship.forward * GUI.Offset.z +
ship.right * GUI.Offset.x +
ship.up * GUI.Offset.y;
}
}
}
else if(indicatorMesh.enabled)
{
indicatorMesh.enabled = false;
}
}
}
}
}