Browse Source

Block gizmos visible in Prefab view

master
JoshuaReason 5 years ago
parent
commit
74bfd13ced
5 changed files with 1367 additions and 1332 deletions
  1. +2
    -2
      Assets/Data/Inventory/BaseInventory.asset
  2. +2
    -2
      Assets/Data/Logic Blocks/Hook Shot.asset
  3. +1321
    -1311
      Assets/Prefabs/Map Sections/Start 4-player.prefab
  4. +21
    -1
      Assets/Scripts/LevelBlocks/Block.cs
  5. +21
    -16
      Assets/Scripts/Utility/DebugExtensions.cs

+ 2
- 2
Assets/Data/Inventory/BaseInventory.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:826ec5d0a327952a321ea2e04fd0bf0bb28619e1f6b1861a4765eddcec2019d6
size 1186
oid sha256:5f56bb5903eab52b34a1586319448b679a19079fdb462de4616981b16d51e2ff
size 1313

+ 2
- 2
Assets/Data/Logic Blocks/Hook Shot.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:946b4189e3b5ea7400bc41121fc5ca3cdb380d0c2b3641856c9ef7893d3b0907
size 599
oid sha256:7c821221422a38d2cdeb8bf229b81065c7ebc7101c7198520d2866415f42892a
size 623

+ 1321
- 1311
Assets/Prefabs/Map Sections/Start 4-player.prefab
File diff suppressed because it is too large
View File


+ 21
- 1
Assets/Scripts/LevelBlocks/Block.cs View File

@ -161,10 +161,28 @@ public class Block : MonoBehaviour
#region Editor Functions #region Editor Functions
private void OnDrawGizmos() private void OnDrawGizmos()
{ {
Vector3 DrawPosition = VisualPosition + Vector3.up * 0.4f;
if (isCollectableSpawnable)
{
Vector3 offset = Vector3.zero;
#if UNITY_EDITOR
offset = Vector3.up * Mathf.Sin((float)UnityEditor.EditorApplication.timeSinceStartup * 0.5f) * 0.1f;
#endif
DebugExtensions.DrawCube(DrawPosition + offset, 0.15f, Color.yellow, 0);
#if UNITY_EDITOR
var view = UnityEditor.EditorWindow.GetWindow<UnityEditor.SceneView>();
view.Repaint();
#endif
}
if (!isSpawnable) if (!isSpawnable)
return; return;
Vector3 DrawPosition = VisualPosition + Vector3.up * 0.4f;
Vector3 Perp = Quaternion.Euler(0, 90, 0) * SpawnDirection.ToVector(); Vector3 Perp = Quaternion.Euler(0, 90, 0) * SpawnDirection.ToVector();
DebugExtensions.DrawCube(DrawPosition, 0.4f, Color.magenta, 0); DebugExtensions.DrawCube(DrawPosition, 0.4f, Color.magenta, 0);
@ -180,6 +198,8 @@ public class Block : MonoBehaviour
DebugExtensions.DrawCube(earPosition + Perp * 0.3f, earScale, Color.magenta, 0); DebugExtensions.DrawCube(earPosition + Perp * 0.3f, earScale, Color.magenta, 0);
DebugExtensions.DrawCube(earPosition - Perp * 0.3f, earScale, Color.magenta, 0); DebugExtensions.DrawCube(earPosition - Perp * 0.3f, earScale, Color.magenta, 0);
} }
#endregion Editor Functions #endregion Editor Functions

+ 21
- 16
Assets/Scripts/Utility/DebugExtensions.cs View File

@ -22,23 +22,28 @@ public static class DebugExtensions
Vector3 min = Position - Extent; Vector3 min = Position - Extent;
Vector3 max = Position + Extent; Vector3 max = Position + Extent;
//Draw bottom Square
Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, min.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, min.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(min.x, min.y, min.z), color, duration, depthTest);
//top square
Debug.DrawLine(new Vector3(min.x, max.y, min.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, max.y, max.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
Color oldColor = Gizmos.color;
Gizmos.color = color;
Gizmos.DrawWireCube(Position, Extent * 2);
Gizmos.color = oldColor;
//connect top and bottom
Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
//Draw bottom Square
// Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, min.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, min.y, min.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(min.x, min.y, min.z), color, duration, depthTest);
//
// //top square
// Debug.DrawLine(new Vector3(min.x, max.y, min.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, max.y, max.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
//
// //connect top and bottom
// Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
// Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save