Skip to content

Commit b83baeb

Browse files
committed
Add BehaviourHelper.LateVisualize;
Add GetWorldPosHeight
1 parent 1362907 commit b83baeb

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

Core/Game/Abilities/BehaviourHelper/BehaviourHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ public void Visualize()
7676
protected virtual void OnVisualize()
7777
{
7878
}
79+
public void LateVisualize () {
80+
OnLateVisualize ();
81+
}
82+
protected virtual void OnLateVisualize () {
83+
84+
}
7985

8086
public void GlobalExecute(Command com)
8187
{

Core/Game/Abilities/BehaviourHelper/BehaviourHelperManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public static void Visualize () {
5151
}
5252
}
5353

54+
public static void LateVisualize () {
55+
foreach ( var helper in Helpers) {
56+
helper.LateVisualize();
57+
}
58+
}
59+
5460
public static void Deactivate () {
5561
foreach (BehaviourHelper helper in Helpers) {
5662
helper.Deactivate ();

Core/Game/Managers/LockstepManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ internal static void LateVisualize ()
313313
DefaultMessageRaiser.LateVisualize ();
314314
AgentController.LateVisualize();
315315
PhysicsManager.LateVisualize();
316+
BehaviourHelperManager.LateVisualize();
316317
}
317318

318319
internal static void DrawGUI ()

Core/Game/Player/RTSInterfacing.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public static void Visualize ()
7575

7676
public static bool CachedDidHit { get; private set; }
7777

78+
public static Vector2d GetWorldPosHeight (Vector2 screenPos, float height = 0) {
79+
Ray ray = Camera.main.ScreenPointToRay (screenPos);
80+
RaycastHit hit;
81+
82+
Vector3 hitPoint = ray.origin - ray.direction * ((ray.origin.y - height) / ray.direction.y);
83+
//return new Vector2d(hitPoint.x * LockstepManager.InverseWorldScale, hitPoint.z * LockstepManager.InverseWorldScale);
84+
return new Vector2d (hitPoint.x, hitPoint.z);
85+
}
7886
public static Vector2d GetWorldPosD (Vector2 screenPos)
7987
{
8088
Ray ray = Camera.main.ScreenPointToRay (screenPos);

0 commit comments

Comments
 (0)