Skip to content

Commit

Permalink
📖 Added documentation, Minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dolejska-daniel committed Dec 18, 2020
1 parent e8c877f commit 601b4c9
Show file tree
Hide file tree
Showing 11 changed files with 551 additions and 11 deletions.
Binary file added Documentation/Documentation.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions Documentation/Documentation.pdf.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

404 changes: 404 additions & 0 deletions Documentation/Documentation.tex

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Documentation/Documentation.tex.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Documentation/img.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Documentation/img/iso_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions Documentation/img/iso_top.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Scripts/GameObjectQuadtreeRoot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Quadtree.Items;
using UnityEngine;

namespace Quadtree
{
[ExecuteInEditMode]
[AddComponentMenu("Spatial partitioning/Quadtree/Root node (for GameObjects)")]
public class GameObjectQuadtreeRoot : QuadtreeMonoRoot<GameObjectItem, Node<GameObjectItem>>
{
}
}
11 changes: 11 additions & 0 deletions Scripts/GameObjectQuadtreeRoot.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Scripts/Items/GameObjectItem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

using UnityEngine;

namespace Quadtree.Items
{
public abstract class GameObjectItem : GameObjectItemBase<GameObjectItem, Node<GameObjectItem>>
{
protected override GameObjectItem This()
{
return this;
}
protected override GameObjectItem This() => this;
}
}
15 changes: 8 additions & 7 deletions Scripts/Items/GameObjectItemBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ private void OnDisable()
{
Root = null;
ItemInitialized = false;
ParentNode.Remove(This());
}

private void LateUpdate()
Expand Down Expand Up @@ -65,17 +66,17 @@ private void LateUpdate()
// CORE TREE ITEM METHODS
//==========================================================================dd==

public TNode ParentNode { get; set; }

public abstract Bounds GetBounds();

public IQuadtreeRoot<TItem, TNode> Root { get; set; }

/// <summary>
/// <c>True</c> if the item has been initialized.
/// </summary>
protected internal bool ItemInitialized = false;

public IQuadtreeRoot<TItem, TNode> Root { get; set; }

public TNode ParentNode { get; set; }

public abstract Bounds GetBounds();

public void QuadTree_Root_Initialized(IQuadtreeRoot<TItem, TNode> root)
{
Root = root;
Expand Down Expand Up @@ -112,7 +113,7 @@ protected virtual void Init()

if (Root == null)
{
if (TryGetComponent(out GameObjectRootNode quadtreeRoot) && quadtreeRoot.Initialized)
if (TryGetComponent(out GameObjectQuadtreeRoot quadtreeRoot) && quadtreeRoot.Initialized)
{
Root = (IQuadtreeRoot<TItem, TNode>)quadtreeRoot;
}
Expand Down

0 comments on commit 601b4c9

Please sign in to comment.