-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMOMTool.cs
134 lines (118 loc) · 4.38 KB
/
MOMTool.cs
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace MetroOverhaul
{
public class MOMTool : BuildingTool
{
public static MOMTool instance;
private ushort m_HoveredBuilding;
private ushort m_HoveredSegment;
private ushort m_HoveredNode;
public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
{
base.RenderOverlay(cameraInfo);
//if (m_hoverInstance.NetNode == 0)
//{
// return;
//}
//var node = NetManager.instance.m_nodes.m_buffer[m_hoverInstance.NetNode];
//RenderManager.instance.OverlayEffect.DrawCircle(
// cameraInfo,
// GetToolColor(false, m_selectErrors != ToolErrors.None),
// node.m_position,
// 15f,
// node.m_position.y - 1f,
// node.m_position.y + 1f,
// true,
// true);
}
protected override void OnEnable()
{
base.OnEnable();
m_toolController.CurrentTool = this;
}
public override void SimulationStep()
{
base.SimulationStep();
if (!enabled)
{
return;
}
//if (!RayCastSegmentAndNode(out var hoveredSegment, out var hoveredNode))
// return;
//var segments = new Dictionary<ushort, SegmentAndNode>();
//if (hoveredSegment != 0)
//{
// var segment = NetManager.instance.m_segments.m_buffer[hoveredSegment];
// var startNode = NetManager.instance.m_nodes.m_buffer[segment.m_startNode];
// var endNode = NetManager.instance.m_nodes.m_buffer[segment.m_endNode];
// var mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
// if (startNode.CountSegments() > 0)
// {
// var bounds = startNode.m_bounds;
// if (hoveredNode != 0)
// {
// bounds.extents /= 2f;
// }
// if (bounds.IntersectRay(mouseRay))
// {
// hoveredNode = segment.m_startNode;
// }
// }
// if (hoveredSegment != 0 && endNode.CountSegments() > 0)
// {
// var bounds = endNode.m_bounds;
// if (hoveredNode != 0)
// {
// bounds.extents /= 2f;
// }
// if (bounds.IntersectRay(mouseRay))
// {
// hoveredNode = segment.m_endNode;
// }
// }
//}
//m_HoveredBuilding = m_hoverInstance.Building;
//if (hoveredNode > 0)
//{
// m_hoverInstance.NetNode = hoveredNode;
//}
//else if (hoveredSegment > 0)
//{
// m_hoverInstance.NetSegment = hoveredSegment;
//}
//m_HoveredSegment = hoveredSegment > 0 ? hoveredSegment : m_hoverInstance.NetSegment;
}
//private static bool RayCastSegmentAndNode(out ushort netSegment, out ushort netNode)
//{
// if (RayCastSegmentAndNode(out var output))
// {
// netSegment = output.m_netSegment;
// netNode = output.m_netNode;
// return true;
// }
// netSegment = 0;
// netNode = 0;
// return false;
//}
//private static bool RayCastSegmentAndNode(out RaycastOutput output)
//{
// var input = new RaycastInput(Camera.main.ScreenPointToRay(Input.mousePosition), Camera.main.farClipPlane)
// {
// m_netService = { m_itemLayers = ItemClass.Layer.Default | ItemClass.Layer.MetroTunnels },
// m_ignoreSegmentFlags = NetSegment.Flags.None,
// m_ignoreNodeFlags = NetNode.Flags.None,
// m_ignoreTerrain = true,
// };
// return RayCast(input, out output);
//}
//private struct SegmentAndNode
//{
// public ushort SegmentId;
// public ushort TargetNode;
//}
}
}