diff options
Diffstat (limited to 'marching/Assets/Scripts')
54 files changed, 221 insertions, 2944 deletions
diff --git a/marching/Assets/Scripts/Physics/FastCircleCollider.cs b/marching/Assets/Scripts/Physics/FastCircleCollider.cs index 88226f2..753aa1c 100644 --- a/marching/Assets/Scripts/Physics/FastCircleCollider.cs +++ b/marching/Assets/Scripts/Physics/FastCircleCollider.cs @@ -9,6 +9,17 @@ public class FastCircleCollider : MonoBehaviour, IQuadTreeObject [SerializeField] private float m_Radius; [SerializeField] private Vector2 m_Offset; + public Vector2 center + { + get + { + Vector3 pos = transform.position + m_Offset.ToVector3(); + return pos; + } + } + + public float radius => m_Radius; + public Vector4 bound { get @@ -23,9 +34,14 @@ public class FastCircleCollider : MonoBehaviour, IQuadTreeObject } } + public Vector2 offset => m_Offset; + public void Awake() { PhysicsManager.quadTreeObjects.Add(this); + Debug.Log(PhysicsManager.quadTreeObjects.Count); + m_Offset = Vector2.zero; + m_Radius = 0.3f; } public void OnDestroy() diff --git a/marching/Assets/Scripts/Physics/PhysicsManager.cs b/marching/Assets/Scripts/Physics/PhysicsManager.cs index 5dff7d4..0577aa9 100644 --- a/marching/Assets/Scripts/Physics/PhysicsManager.cs +++ b/marching/Assets/Scripts/Physics/PhysicsManager.cs @@ -9,10 +9,26 @@ public static class PhysicsManager public static List<IQuadTreeObject> quadTreeObjects = new List<IQuadTreeObject>(); + private static List<IQuadTreeObject> m_SharedCastResult = new List<IQuadTreeObject>(); + public static bool CircleVsCircle(Vector2 pos1, float r1, Vector2 pos2, float r2) { - return false; + return (pos1 - pos2).magnitude < r1+r2; } + /// <summary> + /// box, pos+size + /// </summary> + /// <param name="box"></param> + /// <returns></returns> + public static List<IQuadTreeObject> BoxCast(Vector4 box) + { + m_SharedCastResult.Clear(); + + if (TestQuadtree.quadtree.Retrieve(ref m_SharedCastResult, box)) + { + } + return m_SharedCastResult; + } }
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/Quadtree.cs b/marching/Assets/Scripts/Physics/Quadtree.cs index af7a005..4185f1f 100644 --- a/marching/Assets/Scripts/Physics/Quadtree.cs +++ b/marching/Assets/Scripts/Physics/Quadtree.cs @@ -1,3 +1,5 @@ +using JetBrains.Annotations; +using System; using System.Collections; using System.Collections.Generic; using System.Drawing; @@ -16,8 +18,8 @@ namespace mh public class Quadtree { - public const int kMaxObjectsPerBlock = 4; - public const int kMaxLevel = 20; + public const int kMaxObjectsPerBlock = 5; + public const int kMaxLevel = 6; private int m_Level; private Vector4 m_Bounds; // x,y,z,w => posx,posy,width,height @@ -119,69 +121,86 @@ namespace mh m_SubTrees[3] = QueryQuadtree(m_Level + 1, new Vector4(x + subWidth / 2, y - subHeight / 2, subWidth, subHeight)); } - // x, y, z, w /// <summary> - /// -1±íʾû·¨ÍêÈ«·ÅÔÚÒ»¸ösubTree: subtree½»½ç»òÕßÕû¸öÔ½½ç + /// 0±íʾû·¨ÍêÈ«·ÅÔÚÒ»¸ösubTree: subtree½»½ç»òÕßÕû¸öÔ½½ç /// </summary> /// <param name="bound"></param> /// <returns></returns> - public int GetSubtreeIndex(Vector4 bound) + public int GetSubtreeIndices(Vector4 bound) { + int indices = 0; float halfw = bound.z / 2; float halfh = bound.w / 2; - float lowerx = bound.x - halfw; - float higherx = bound.x + halfw; + float lowerx = bound.x - halfw; + float higherx = bound.x + halfw; float lowery = bound.y - halfh; float highery = bound.y + halfh; - bool bFitInLeft = lowerx >= left && higherx <= x; - bool bFitInRight = lowerx >= x && higherx <= right; - bool bFitInTop = lowery >= y && highery <= top; - bool bFitInBottom = lowery >= bottom && highery <= y; - if (bFitInRight && bFitInTop) return 0; - if (bFitInLeft && bFitInTop) return 1; - if (bFitInLeft && bFitInBottom) return 2; - if (bFitInRight && bFitInBottom) return 3; - return -1; + bool startIsNorth = highery > y; + bool startIsWest = lowerx < x; + bool endIsEast = higherx > x; + bool endIsSouth = lowery < y; + //top-right quad + if (startIsNorth && endIsEast) + { + indices |= 1; + } + + //top-left quad + if (startIsWest && startIsNorth) + { + indices |= 1 << 1; + } + + //bottom-left quad + if (startIsWest && endIsSouth) + { + indices |= 1 << 2; + } + + //bottom-right quad + if (endIsEast && endIsSouth) + { + indices |= 1 << 3; + } + + return indices; } public void Insert(IQuadTreeObject obj) { - int index = GetSubtreeIndex(obj.bound); - if(index != -1) + if (m_SubTrees[0] != null) { - if (m_SubTrees[0] == null) Split(); - m_SubTrees[index].Insert(obj); + int indices = GetSubtreeIndices(obj.bound); + for(int i = 0; i < 4; i++) + { + if((indices & (1 << i)) != 0) + { + m_SubTrees[i].Insert(obj); + } + } return; } - //if (m_SubTrees[0] != null) - //{ - // if (index != -1) - // { - // m_SubTrees[index].Insert(obj); - // return; - // } - //} - m_Objects.Add(obj); - if(m_Objects.Count > kMaxObjectsPerBlock && m_Level < kMaxLevel) // ±¾²ãÂúÁËÖ®ºóÖØÐÂÅŲ¼²ãÄÚ¶ÔÏó + if (m_Objects.Count > kMaxObjectsPerBlock && m_Level < kMaxLevel) // ±¾²ãÂúÁËÖ®ºóÖØÐÂÅŲ¼²ãÄÚ¶ÔÏó { if (m_SubTrees[0] == null) Split(); - for(int i = m_Objects.Count - 1; i >= 0; i--) + for (int i = m_Objects.Count - 1; i >= 0; i--) { - index = GetSubtreeIndex(m_Objects[i].bound); - if(index != -1) + int indices = GetSubtreeIndices(m_Objects[i].bound); + for (int j = 0; j < 4; j++) { - IQuadTreeObject o = m_Objects[i]; - m_Objects.RemoveAt(i); - m_SubTrees[index].Insert(o); + if ((indices & (1 << j)) != 0) + { + m_SubTrees[j].Insert(m_Objects[i]); + } } } - } - // Debug.Log(m_Objects.Count); + m_Objects.Clear(); + } } /// <summary> @@ -192,15 +211,52 @@ namespace mh /// <returns></returns> public bool Retrieve(ref List<IQuadTreeObject> returnObjs, IQuadTreeObject obj) { - int index = GetSubtreeIndex(obj.bound); - returnObjs.AddRange(m_Objects); - if (index != -1 && m_SubTrees[0] != null) + for(int i = 0; i < m_Objects.Count; ++i) { - m_SubTrees[index].Retrieve(ref returnObjs, obj); + if (!returnObjs.Contains(m_Objects[i]) && obj != m_Objects[i]) + { + returnObjs.Add(m_Objects[i]); + } } - if(returnObjs.Contains(obj)) + if (m_SubTrees[0] != null) { - returnObjs.Remove(obj); + int indices = GetSubtreeIndices(obj.bound); + for (int i = 0; i < 4; i++) + { + if ((indices & (1 << i)) != 0) + { + m_SubTrees[i].Retrieve(ref returnObjs, obj); + } + } + } + return returnObjs.Count > 0; + } + + /// <summary> + /// »ñµÃ¿ÉÄܺÍobjÅöײµÄ¶ÔÏ󣨲»°üÀ¨×Ô¼º£© + /// </summary> + /// <param name="returnObjs"></param> + /// <param name="obj"></param> + /// <returns></returns> + public bool Retrieve(ref List<IQuadTreeObject> returnObjs, Vector4 bound) + { + for (int i = 0; i < m_Objects.Count; ++i) // ¸ù½Úµãcount==0 + { + if (!returnObjs.Contains(m_Objects[i])) + { + returnObjs.Add(m_Objects[i]); + } + } + if (m_SubTrees[0] != null) + { + int indices = GetSubtreeIndices(bound); + for (int i = 0; i < 4; i++) + { + if ((indices & (1 << i)) != 0) + { + m_SubTrees[i].Retrieve(ref returnObjs, bound); + } + } } return returnObjs.Count > 0; } diff --git a/marching/Assets/Scripts/Physics/TestQuadtree.cs b/marching/Assets/Scripts/Physics/TestQuadtree.cs index 07ed353..3159853 100644 --- a/marching/Assets/Scripts/Physics/TestQuadtree.cs +++ b/marching/Assets/Scripts/Physics/TestQuadtree.cs @@ -27,11 +27,15 @@ namespace mh // Update is called once per frame void Update() { + } + + private void FixedUpdate() + { m_Quadtree.Clear(false); var pos = UnitManager.hero.transform.position; m_Quadtree.Rebound(new Vector4(pos.x, pos.y, 50, 50)); var objs = PhysicsManager.quadTreeObjects; - for(int i = 0; i < objs.Count; ++i) + for (int i = 0; i < objs.Count; ++i) { TestQuadtree.quadtree.Insert(objs[i]); } diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitattributes b/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitattributes deleted file mode 100644 index 67e9432..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitattributes +++ /dev/null @@ -1,37 +0,0 @@ -# Macro for Unity YAML-based asset files. -[attr]unityyaml -text merge=unityyamlmerge diff - -# Macro for all binary files that should use Git LFS. -[attr]lfs -text filter=lfs diff=lfs merge=lfs - -# Default to auto-normalized line endings. -* text=auto - -# Code -*.cs text diff=csharp - -# Unity Text Assets -*.meta unityyaml -*.unity unityyaml -*.asset unityyaml -*.prefab unityyaml -*.mat unityyaml -*.anim unityyaml -*.controller unityyaml -*.overrideController unityyaml -*.physicMaterial unityyaml -*.physicsMaterial2D unityyaml -*.playable unityyaml -*.mask unityyaml -*.brush unityyaml -*.flare unityyaml -*.fontsettings unityyaml -*.guiskin unityyaml -*.giparams unityyaml -*.renderTexture unityyaml -*.spriteatlas unityyaml -*.terrainlayer unityyaml -*.mixer unityyaml -*.shadervariants unityyaml -*.preset unityyaml -*.asmdef -text diff diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitignore b/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitignore deleted file mode 100644 index e69de29..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/.gitignore +++ /dev/null diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation.meta deleted file mode 100644 index c15b783..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9b21012c21de4ef45b824ee1bc1eabd4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf Binary files differdeleted file mode 100644 index e53743f..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf +++ /dev/null diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf.meta deleted file mode 100644 index fd64804..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.pdf.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: de4cbf0348149a9468a47b2fbcb66a67 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex deleted file mode 100644 index 5fed6b5..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex +++ /dev/null @@ -1,404 +0,0 @@ -\documentclass{article} - -%=============================================================================== -% -%=============================================================================== -\usepackage[english]{babel} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} -\usepackage{float} -\usepackage{graphicx} -\usepackage{multicol} -\usepackage{caption} -\usepackage{subcaption} -\usepackage{vmargin} -\usepackage[colorlinks]{hyperref} -\usepackage{indentfirst} -\usepackage{wrapfig} -\usepackage{dirtytalk} -\usepackage[newfloat]{minted} -\usepackage{cleveref} - -\graphicspath{{img/}} - -% Možnost referencà na footnotes https://tex.stackexchange.com/a/35044/160241 -\makeatletter -\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark} -\makeatother - -%=============================================================================== -% -%=============================================================================== -\title{Quadtree Spatial Partitioning for Unity} -\author{Daniel DolejÅ¡ka\\\small\texttt{dolejskad@gmail.com}\\\small\url{https://github.com/dolejska-daniel/unity-quadtree}} -\date{\today} - -%=============================================================================== -% -%=============================================================================== -\begin{document} - -%----------------------------------------------------------- -% Title page -%----------------------------------------------------------- -\maketitle - -\tableofcontents - -\newpage - -%----------------------------------------------------------- -% Package introduction & contents -%----------------------------------------------------------- -\section{Introduction} -This package provides generic implementation of the quadtree\footnote{\url{https://en.wikipedia.org/wiki/Quadtree}} spatial partitioning algorithm. -The aim of this package is to provide an out of the box working solution for simple 2D spatial partitioning of Unity's \texttt{GameObject}s but at the same time allowing the implementation to be easily extended, modified and used with \textit{any} items that you would want it to. -The tree can be used as a~component of a~\texttt{GameObject} or it can just as easily be used only in the scripts without it being attached to any \texttt{GameObject}. - -As mentioned before this package provides out of the box solution for \texttt{GameObject}s\,---\,more on that topic in section \ref{usage:editor}. -Programmatic usage of the quadtree implementation is further described in section \ref{usage:code}. -Section \ref{details} goes into some useful details of the implemented quadtree structures. -Finally section \ref{extensions} describes ways to extend the current implementation. - -\begin{figure}[H] - \centering - \includegraphics[width=.75\textwidth]{iso_top.png} - \caption{Visualization of the quadtree structure for 5 \texttt{GameObject}s} - \label{fig:demo:overview} - \medskip\small - A~view of the gizmos generated by the quadtree implementation for Unity's \texttt{GameObject}s from the editor. -\end{figure} - -\section{Package Contents} -\begin{description} - \item[\texttt{Scenes/}] - directory contains example Unity scene(s) demonstrating usage of the package. - - \item[\texttt{Documentation/}] - directory contains offline documentation. - - \item[\texttt{Scripts/}] - directory contains all package's script source codes. -\end{description} - -%----------------------------------------------------------- -% Usage details -%----------------------------------------------------------- -\section{Usage} \label{usage} -This section describes the usage of the scripts provided by this package. -Simple editor usage for \texttt{GameObject}s with \texttt{Renderer} components is described in \ref{usage:editor}. -Section \ref{usage:code} then describes how to use the structures in the scripts. - -\subsection{From Editor (Out of the Box)} \label{usage:editor} -Section \ref{usage:editor:store} explains how are objects stored in the tree structure and how it is set-up. -Then section \ref{usage:editor:find} gives an example how to search the structure and find previously stored objects. -Finally section \ref{usage:editor:remove} describes how the item removal from the tree works and is used. - -\subsubsection{Setting Up the Tree} \label{usage:editor:setup} -Before we can play with the items in the tree, we first need to add a~root of our quadtree to the scene. -The initial setup of the root of the quadtree is extremely simple: -\begin{itemize} - \item Create empty \texttt{GameObject}. - - This can be done by right-clicking in the \textit{Hierarchy} window and selecting \say{Create Empty}. - \texttt{GameObject} you've now created will be used as a~root for the tree. - Keep your newly created empty \texttt{GameObject} instance selected. - - \item From window dropdown menu select: \textit{Component > Spatial partitioning > Quadtree > Rootnode (for GameObjects)}. - - This command will add \texttt{GameObjectQuadtreeRoot} script component to the previously created \texttt{GameObject}. - At this point you should be able to see white rectangle on the screen (make sure your gizmos are enabled and showing up in the editor). -\end{itemize} - -\subsubsection{Storing Objects} \label{usage:editor:store} -Now with the tree root set-up -\begin{itemize} - \item Add \texttt{GameObject}s you wish to be in the tree as children of the tree root \texttt{GameObject}. - - The item must have any \texttt{Renderer} component\,---\,\texttt{MeshRenderer}, \texttt{SpriteRenderer}, \dots - For example create any \texttt{GameObject} with \texttt{Renderer} component\,---\,do that by right-clicking on the tree root \texttt{GameObject} and selecting anything from submenu \textit{3D Object} or add your own! - You've now added object supported by the quadtree, keep it selected in the \textit{hierarchy} window. - - \item From window dropdown menu select: \textit{Component > Spatial partitioning > Quadtree > Items > Renderer-based Item}. - - This command will add \texttt{RendererItem} script component to the previously added \texttt{GameObject}. - At this point you should be able to see that the previous simple rectangle has somewhat changed. - Try moving the item around, you should see the quadtree structure changing based on the current position of the item. -\end{itemize} - -\subsubsection{Looking up Objects} \label{usage:editor:find} -Looking up objects from editor does not make much sense, since you will probably want to look the items up in a~code which will then work with them. -How to look up the objects in the tree is described in section \ref{usage:code:find}. - -\subsubsection{Removing Objects} \label{usage:editor:remove} -Removing the items stored in the tree with \texttt{Renderer}-based item components is just removing either the \texttt{RendererItem} script component from the \texttt{GameObject} or removing the \texttt{GameObject} itself. -Simple as that. - -\subsection{From Code} \label{usage:code} -This section describes how can you control the tree structure from the code. - -\subsubsection{Storing Objects} \label{usage:code:store} -The stored items do not necessarily need to be children of the root node, but it allows the tree to fill completely automatically. -You can add items to the tree using scripts too, thought the item type must match with the item type of the tree root. -To add item to the tree follow the code shown in Listing \ref{code:insert}. - -\begin{listing}[H] - \begin{minted}{csharp} -// get the tree root component of the tree you want to insert to -var root = GetComponent<GameObjectQuadtreeRoot>(); -// locate the GameObject to be added into the tree -var itemGO = GameObject.Find("Game Object Name"); - -// locate the tree item component of the GameObject -var item = itemGO.GetComponent<RendererItem>(); - -// insert the item to the tree using the Insert method -// the tree itself will find the smallest node to store it in -root.Insert(item); - \end{minted} - \vspace{-1em} - \caption{Inserting Item to the Tree} \label{code:insert} - \smallskip\small\centering - This code snippet first locates the root of the quadtree, the \texttt{GameObject} to be inserted into the tree and its quadtree item component. - Algorithm then inserts the item component into the tree via its root. -\end{listing} - -\subsubsection{Looking up Objects} \label{usage:code:find} -To look up the stored objects you will need to use Unity's \texttt{Bounds}\footnote{\url{https://docs.unity3d.com/ScriptReference/Bounds-ctor.html}} object. -This object describes an area in which the algorithm will look for the items. -Follow code shown in Listing \ref{code:look_up}. - -\begin{listing}[H] - \begin{minted}{csharp} -// get the tree root component of the tree you want to search in -var root = GetComponent<GameObjectQuadtreeRoot>(); - -// locate or define the Bounds to be used in the search -// bounds defined below will find all items with bounds -// intersecting between (-5, 0, -5) and (5, 0, 5) -var bounds = new Bounds(Vector3.zero, new Vector3(10f, 0f, 10f)); - -// pass the bounds to the Find method of the root and -// the tree itself will find all the items with intersecting bounds -var items = root.Find(bounds); - -// the Find method returns List of all found items -// continue as you will -foreach (var item in items) -{ - // process found items ... -} - \end{minted} - \vspace{-1em} - \caption{Looking Up Stored Objects} \label{code:look_up} - \smallskip\small\centering - This code snippet first locates the root of the quadtree and creates the \texttt{Bounds} object which defines the search area. - Algorithm then locates all items intersecting with the provided \texttt{Bounds} via tree root. -\end{listing} - -% TODO: Create image visually depicting the search process and matching items - -\subsubsection{Removing Objects} \label{usage:code:remove} -Removing the items from the tree is as easy as adding them in. -There are actually two ways to delete the item from the tree. -The location of the \texttt{GameObject} and its tree item component is the same for both possibilities. - -The first removal option is to use the reference to the parent node, by which is the item currently contained, from the item object instance. -Since the item is actually contained by that node, the algorithm won't have to traverse the tree and look for the node which contains the item. -With the variables defined in the snippet above: - -\begin{listing}[H] - \begin{minted}{csharp} -// locate the GameObject to be removed from the tree -var itemGO = GameObject.Find("Game Object Name"); -// locate the tree item component of the GameObject -var item = itemGO.GetComponent<RendererItem>(); - -// task the parent node with the removal of the item from the tree -item.ParentNode.Remove(item); - \end{minted} - \vspace{-1em} - \caption{Removing the Item Via Its Parent Node} \label{code:remove:1} - \smallskip\small\centering - This code snippet removes the \texttt{GameObject}'s quadtree item from the tree via its own reference to the node in which it is currently contained. -\end{listing} - -The second option is to pass the item to the tree root itself to remove the item. -The algorithm will have to traverse the tree to find correct node to remove the item from hence the former removal option is faster than the latter. -With the variables defined in the snippet above: - -\begin{listing}[H] - \begin{minted}{csharp} -// locate the GameObject to be removed from the tree -var itemGO = GameObject.Find("Game Object Name"); -// locate the tree item component of the GameObject -var item = itemGO.GetComponent<RendererItem>(); - -// get the tree root component of the tree you want to remove from -var root = GetComponent<GameObjectQuadtreeRoot>(); - -// task the tree root with the removal of the item -root.Remove(item); - \end{minted} - \vspace{-1em} - \caption{Removing the Item via Tree Root} \label{code:remove:2} - \smallskip\small\centering - This code snippet removes the \texttt{GameObject}'s quadtree item from the tree via root of the tree. -\end{listing} - - -%----------------------------------------------------------- -% Implementation details -%----------------------------------------------------------- -\section{Implementation Details} \label{details} -This section aims to explain some important thoughts behind implementation of this library. -It should help you understand how is this library supposed to generally work. -The goal of this library is to allow maximum flexibility for you\,---\,the data structures are designed to allow \textit{any} items to be stored in the tree\,---\,the only requirement is implementation of predefined interface of the items. - -As part of this package, there is already prepared tree item implementation supporting any \texttt{GameObject} instances with \texttt{Renderer} components. -This implementation works out of the box. - -\subsection{Tree Root} \label{details:root} -Tree root represents the tree itself and provides an entry point for all the algorithms operating on the tree structure. -There always is only single tree root for a~single tree instance. -Tree root class is the main interface of the quadtree\,---\,any search, insertion or deletion starts in the root of the tree. - -\begin{minted}{csharp} -public interface IQuadtreeRoot<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> -\end{minted} - -This is the interface that any tree root implementation should have. -Thought if you wish to implement your own tree root class from scratch nothing is stopping you! -Of course extending either \texttt{QuadtreeRoot} or \texttt{QuadtreeMonoRoot} is a~more sensible thing to do. -More on that topic in section \ref{extensions:custom_roots}. - -\begin{minted}{csharp} -public class QuadtreeRoot<TItem, TNode> : IQuadtreeRoot<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode>, new() -\end{minted} - -This is the actual used class implementing all that is necessary for a~tree root. -It allows anyone to further specify \texttt{TItem} and \texttt{TNode} which are classes of the items, respectively the nodes of the tree. -The only constraint for item classes is an implementation of interface \texttt{TItem}. -Tree node classes must implement \texttt{TNode} interface and have a parameterless constructor. - -The previously mentioned class \texttt{QuadtreeMonoRoot} does actually not derive from \texttt{QuadtreeRoot}, because C\# does not allow multiple inheritance and to be able to use the class as a~\texttt{GameObject} component in Unity it must derive from \texttt{MonoBehaviour}. -Hence \texttt{QuadtreeMonoRoot} only implements the interface \texttt{IQuadtreeRoot} as a~proxy of \texttt{QuadtreeRoot}. -The class \texttt{GameObjectQuadtreeRoot} then derives from \texttt{QuadtreeMonoRoot} and specifies its type arguments as shown below. -Fully specifying types for generic classes is the last required step for the class to be used as a~\texttt{GameObject} component. - -\begin{minted}{csharp} -public class GameObjectQuadtreeRoot : QuadtreeMonoRoot<GameObjectItem, Node<GameObjectItem>> -\end{minted} - -\subsection{Tree Node} \label{details:node} -The \texttt{Node} class represents hierarchy of the tree. -It contains items stored in the tree and nodes which are lower in the hierarchy but still within its own boundaries. -There is usually no need to work with the nodes themselves\,---\,all actions should be done through root of the tree. -As mentioned before every node implementation must implement the \texttt{INode} interface. - -\begin{minted}{csharp} -public interface INode<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> -\end{minted} - -If it does and also has a~public parameterless constructor, then you can use it instead of original \texttt{Node} implementation. -More about implementing custom node classes in section \ref{extensions:custom_nodes}. - -The original implementation of the tree \texttt{Node}s derives from \texttt{NodeBase} which actually implements all the necessary functionality and, of course, the \texttt{INode} interface. -What \texttt{Node} does is just type specification of the \texttt{TNode} type parameter of the \texttt{NodeBase} class. - -\begin{minted}{csharp} -public class Node<TItem> : NodeBase<TItem, Node<TItem>> - where TItem : IItem<TItem, Node<TItem>> {} -\end{minted} - -\subsection{Tree Item} \label{details:item} -Tree item classes represent the items in the tree. -All the classes must implement the \texttt{IItem} interface so the nodes know how to operate with the items. -More about implementing custom item classes in section \ref{extensions:custom_items}. - -\begin{minted}{csharp} -public interface IItem<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> -\end{minted} - -The implementation for \texttt{GameObjects} uses a~number of classes but almost all the necessary logic is contained in the \texttt{GameObjectItemBase} class. -This class implements the \texttt{IItem} interface and all the necessarry logic for subclasses to work \textit{almost} automatically. -The \texttt{GameObjectItemBase} is implemented as \mintinline{csharp}{abstract} and requires only \texttt{GetBounds()} \textit{(and \texttt{This()})} method to be implemented by its subclasses. -It also derives from \texttt{MonoBehaviour} so it can be used as a~\texttt{GameObject} component. - -\begin{minted}{csharp} -public abstract class GameObjectItemBase<TItem, TNode> - : MonoBehaviour, IItem<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> -\end{minted} - -The \texttt{GameObjectItem} class then derives from \texttt{GameObjectItemBase}. -It, again, only specifies the type parameters of its superclass and extremely simple implementation of the \texttt{This()} method necessary for correct type checking. - -\begin{minted}{csharp} -public abstract class GameObjectItem - : GameObjectItemBase<GameObjectItem, Node<GameObjectItem>> -{ - protected override GameObjectItem This() => this; -} -\end{minted} - -Finally the \texttt{RendererItem} class comes into light. -It further derives from \texttt{GameObjectItem} and implements the required \texttt{GetBounds()} method so the \texttt{GameObjectItemBase} can work properly. -This class specifically extracts the bounds from the \texttt{Renderer} component of the \texttt{GameObject} it is currently attached to. - -%----------------------------------------------------------- -% Extending implementation -%----------------------------------------------------------- -\section{Extending Implementation} \label{extensions} -Implementing custom structures and modifying existing ones should be pretty straightforward. -Just subclass the structure you wish to modify, override the implemented methods, et voilà ! -It should be that simple. - -\subsection{Custom Items} \label{extensions:custom_items} -If you implement custom item classes you will also need to create a~custom tree root implementation which supports usage of those items (exception to this are subclasses of \texttt{GameObjectItem} using \texttt{GameObjectQuadtreeRoot}). -But this is very simple too, as shown below. - -\begin{minted}{csharp} -public class CustomItem : IItem<CustomItem, Node<CustomItem>> -{ - // TODO: Implement required interface of IItem here -} - -public class CustomQuadtreeRoot : QuadtreeRoot<CustomItem, Node<CustomItem>> {} -\end{minted} - -\subsection{Custom Nodes} \label{extensions:custom_nodes} -It's the same thing with the nodes as it is with the items\,---\,ff you implement custom node classes you will also need to create a~custom tree root implementation which supports usage of those items. - -\begin{minted}{csharp} -public class CustomNode<TItem> : NodeBase<TItem, CustomNode<TItem>> - where TItem : IItem<TItem, CustomNode<TItem>> -{ - // TODO: Override the NodeBase methods here -} - -public class CustomQuadtreeRoot : QuadtreeRoot<CustomItem, CustomNode<CustomItem>> {} -\end{minted} - -\subsection{Custom Roots} \label{extensions:custom_roots} -As shown a~number of times in the previous sections\,--\,creating a~custom tree root implementation is quite simple. -No class body has been provided in the previous section since modification of the item's or node's type has been enough, but you can override any method of your choosing of course. - -\begin{minted}{csharp} -public class CustomQuadtreeRoot : QuadtreeRoot<CustomItem, CustomNode<CustomItem>> -{ - // TODO: Override the QuadtreeRoot methods here - // TODO: Implement custom methods here -} -\end{minted} - -\end{document} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex.meta deleted file mode 100644 index b7fa92e..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/Documentation.tex.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 34ca991aa8a9b1641be772a4a6d84ff9 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img.meta deleted file mode 100644 index d0a2ab7..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c608f6ef446f13d43a0def8b89e79f7c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png Binary files differdeleted file mode 100644 index 9d47ccb..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png +++ /dev/null diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png.meta deleted file mode 100644 index ad37279..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Documentation/img/iso_top.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 2dd3b1485b84dbc498aff0b72000efcf -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md b/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md deleted file mode 100644 index 75a531b..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019-2020 Daniel DolejÅ¡ka - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md.meta deleted file mode 100644 index e9989d0..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/LICENSE.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0dde43bb65349ac45baa2bcd10ed104d -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef b/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef deleted file mode 100644 index c426ef5..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef +++ /dev/null @@ -1,3 +0,0 @@ -{
- "name": "Quadtree"
-}
diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef.meta deleted file mode 100644 index d653e52..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Quadtree.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b98210e2f6e8aad40807742e65482e6c -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md b/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md deleted file mode 100644 index c7e3045..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Quadtree for Unity -> v1.0 - -This package provides a generic implementation of the quadtree spatial partitioning algorithm. -The aim of this package is to provide an out of the box working solution for simple 2D spatial partitioning of Unity’s GameObjects but at the same time allowing the implementation to be easily extended, modified and used with any items that you would want it to. -The tree can be used as a component of a GameObject or it can just as easily be used only in the scripts without it being attached to any GameObject. - - - - -## Installation -Please refer to the [releases page](https://github.com/dolejska-daniel/unity-quadtree/releases). - - -## Usage examples -Please refer to the [PDF documentation](Documentation/Documentation.pdf). diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md.meta deleted file mode 100644 index f6fe0c4..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/README.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ddd6f21fcb74f7843b692364b99f0531 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes.meta deleted file mode 100644 index 4fdb0ef..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d260bcd964b29d149b4ca74f10a39bdb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity deleted file mode 100644 index f1cc1d7..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity +++ /dev/null @@ -1,958 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 9 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} - m_UseRadianceAmbientProbe: 0 ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 12 - m_GIWorkflowMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_LightmapEditorSettings: - serializedVersion: 12 - m_Resolution: 2 - m_BakeResolution: 40 - m_AtlasSize: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAmbientOcclusion: 0 - m_Padding: 2 - m_LightmapParameters: {fileID: 0} - m_LightmapsBakeMode: 1 - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 - m_ReflectionCompression: 2 - m_MixedBakeMode: 2 - m_BakeBackend: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 500 - m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 500 - m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 2 - m_PVRDenoiserTypeDirect: 0 - m_PVRDenoiserTypeIndirect: 0 - m_PVRDenoiserTypeAO: 0 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 0 - m_PVRCulling: 1 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 0} - m_LightingSettings: {fileID: 1735603003} ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - manualTileSize: 0 - tileSize: 256 - accuratePlacement: 0 - maxJobWorkers: 0 - preserveTilesOutsideBounds: 0 - debug: - m_Flags: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &373392157 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 373392158} - - component: {fileID: 373392162} - - component: {fileID: 373392161} - - component: {fileID: 373392160} - - component: {fileID: 373392159} - m_Layer: 0 - m_Name: Cube (4) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &373392158 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 373392157} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 2.13, y: 0, z: 1.63} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1716388990} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &373392159 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 373392157} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b92b133d7eeb95b4d95b27cf8ef679b0, type: 3} - m_Name: - m_EditorClassIdentifier: - InsertOnInitialization: 1 ---- !u!65 &373392160 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 373392157} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &373392161 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 373392157} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &373392162 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 373392157} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &705507993 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 705507995} - - component: {fileID: 705507994} - m_Layer: 0 - m_Name: Directional Light - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!108 &705507994 -Light: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 705507993} - m_Enabled: 1 - serializedVersion: 10 - m_Type: 1 - m_Shape: 0 - m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} - m_Intensity: 1 - m_Range: 10 - m_SpotAngle: 30 - m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 - m_Shadows: - m_Type: 2 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_CullingMatrixOverride: - e00: 1 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 1 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 1 - m_UseCullingMatrixOverride: 0 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingLayerMask: 1 - m_Lightmapping: 1 - m_LightShadowCasterMode: 0 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} - m_UseBoundingSphereOverride: 0 - m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 - m_ShadowAngle: 0 ---- !u!4 &705507995 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 705507993} - m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} - m_LocalPosition: {x: 0, y: 3, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &903130919 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 903130920} - - component: {fileID: 903130924} - - component: {fileID: 903130923} - - component: {fileID: 903130922} - - component: {fileID: 903130921} - m_Layer: 0 - m_Name: Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &903130920 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 903130919} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.12, y: 0, z: 6.91} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1716388990} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &903130921 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 903130919} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b92b133d7eeb95b4d95b27cf8ef679b0, type: 3} - m_Name: - m_EditorClassIdentifier: - InsertOnInitialization: 1 ---- !u!65 &903130922 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 903130919} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &903130923 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 903130919} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &903130924 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 903130919} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &920762437 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 920762438} - - component: {fileID: 920762442} - - component: {fileID: 920762441} - - component: {fileID: 920762440} - - component: {fileID: 920762439} - m_Layer: 0 - m_Name: Cube (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &920762438 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 920762437} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -14.52, y: 0, z: 9.07} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1716388990} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &920762439 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 920762437} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b92b133d7eeb95b4d95b27cf8ef679b0, type: 3} - m_Name: - m_EditorClassIdentifier: - InsertOnInitialization: 1 ---- !u!65 &920762440 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 920762437} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &920762441 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 920762437} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &920762442 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 920762437} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &963194225 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 963194228} - - component: {fileID: 963194227} - - component: {fileID: 963194226} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &963194226 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_Enabled: 1 ---- !u!20 &963194227 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &963194228 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 963194225} - m_LocalRotation: {x: 0.116701886, y: -0.8765657, z: 0.38296157, w: 0.26712108} - m_LocalPosition: {x: 15.853614, y: 23.44027, z: 17.469078} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1716388988 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1716388990} - - component: {fileID: 1716388989} - m_Layer: 0 - m_Name: Quadtree Root - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1716388989 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1716388988} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2ec46052397248d478fc24737435f7a9, type: 3} - m_Name: - m_EditorClassIdentifier: - DefaultRootNodeSize: {x: 64, y: 0, z: 64} - MinimumPossibleNodeSize: 1 - DisplayNumberOfItemsInGizmos: 1 ---- !u!4 &1716388990 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1716388988} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 903130920} - - {fileID: 920762438} - - {fileID: 2095094705} - - {fileID: 1792152520} - - {fileID: 373392158} - m_Father: {fileID: 0} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!850595691 &1735603003 -LightingSettings: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Settings.lighting - serializedVersion: 3 - m_GIWorkflowMode: 1 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_RealtimeEnvironmentLighting: 1 - m_BounceScale: 1 - m_AlbedoBoost: 1 - m_IndirectOutputScale: 1 - m_UsingShadowmask: 1 - m_BakeBackend: 1 - m_LightmapMaxSize: 1024 - m_BakeResolution: 40 - m_Padding: 2 - m_TextureCompression: 1 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_ExtractAO: 0 - m_MixedBakeMode: 2 - m_LightmapsBakeMode: 1 - m_FilterMode: 1 - m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_RealtimeResolution: 2 - m_ForceWhiteAlbedo: 0 - m_ForceUpdates: 0 - m_FinalGather: 0 - m_FinalGatherRayCount: 256 - m_FinalGatherFiltering: 1 - m_PVRCulling: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 500 - m_PVREnvironmentSampleCount: 500 - m_PVREnvironmentReferencePointCount: 2048 - m_LightProbeSampleCountMultiplier: 4 - m_PVRBounces: 2 - m_PVRMinBounces: 2 - m_PVREnvironmentMIS: 0 - m_PVRFilteringMode: 2 - m_PVRDenoiserTypeDirect: 0 - m_PVRDenoiserTypeIndirect: 0 - m_PVRDenoiserTypeAO: 0 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 ---- !u!1 &1792152519 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1792152520} - - component: {fileID: 1792152524} - - component: {fileID: 1792152523} - - component: {fileID: 1792152522} - - component: {fileID: 1792152521} - m_Layer: 0 - m_Name: Cube (3) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1792152520 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1792152519} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 13.85, y: 0, z: -13.67} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1716388990} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1792152521 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1792152519} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b92b133d7eeb95b4d95b27cf8ef679b0, type: 3} - m_Name: - m_EditorClassIdentifier: - InsertOnInitialization: 1 ---- !u!65 &1792152522 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1792152519} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &1792152523 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1792152519} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1792152524 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1792152519} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &2095094704 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2095094705} - - component: {fileID: 2095094709} - - component: {fileID: 2095094708} - - component: {fileID: 2095094707} - - component: {fileID: 2095094706} - m_Layer: 0 - m_Name: Cube (2) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2095094705 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2095094704} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -12.75, y: 0, z: -12.9} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1716388990} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &2095094706 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2095094704} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b92b133d7eeb95b4d95b27cf8ef679b0, type: 3} - m_Name: - m_EditorClassIdentifier: - InsertOnInitialization: 1 ---- !u!65 &2095094707 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2095094704} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &2095094708 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2095094704} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &2095094709 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2095094704} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity.meta deleted file mode 100644 index 952bd1e..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scenes/SampleScene.unity.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9fc0d4010bbf28b4594072e72b8655ab -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts.meta deleted file mode 100644 index 1acb1b2..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6797b42104d1f284da68b91b7d8cae28 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectQuadtreeRoot.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectQuadtreeRoot.cs deleted file mode 100644 index 6828ec9..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectQuadtreeRoot.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Quadtree.Items; -using UnityEngine; - -namespace Quadtree -{ - [ExecuteInEditMode] - [AddComponentMenu("Spatial partitioning/Quadtree/Root node (for GameObjects)")] - public class GameObjectQuadtreeRoot : QuadtreeMonoRoot<GameObjectItem, Node<GameObjectItem>> - { - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs deleted file mode 100644 index 6f61b98..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Quadtree.Items; -using UnityEngine; - -namespace Quadtree -{ - [ExecuteInEditMode] - [AddComponentMenu("Spatial partitioning/Quadtree/Root node (for GameObjects)")] - public class GameObjectRootNode : QuadtreeMonoRoot<GameObjectItem, Node<GameObjectItem>> - { - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs.meta deleted file mode 100644 index f81061e..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectRootNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c89dce857aba9634ea60cbbb363aef7f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs deleted file mode 100644 index bd0d22b..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs +++ /dev/null @@ -1,118 +0,0 @@ -using Quadtree.Items; -using System.Collections.Generic; -using UnityEngine; - -namespace Quadtree -{ - /// <summary> - /// Mandatory interface of any single quadtree node. - /// </summary> - public interface INode<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> - { - /// <summary> - /// Bounds of this tree node. - /// </summary> - Bounds Bounds { get; set; } - - /// <summary> - /// Root of the whole tree. - /// </summary> - IQuadtreeRoot<TItem, TNode> TreeRoot { get; set; } - - /// <summary> - /// Reference to parent tree node. - /// </summary> - /// <remarks> - /// Is <c>null</c> for root node of the tree. - /// </remarks> - TNode ParentNode { get; set; } - - /// <summary> - /// Child nodes of this node. - /// </summary> - IList<TNode> SubNodes { get; set; } - - /// <summary> - /// Verifies whether provided boundaries (<paramref name="bounds"/>) are fully contained within the boundaries of the node. - /// </summary> - /// - /// <param name="bounds">Boundaries of an object</param> - /// <returns><c>True</c> if object is fully contained within the node, <c>False</c> otherwise</returns> - bool Contains(Bounds bounds); - - /// <summary> - /// Calculates relative internal position of the provided bounds (<paramref name="bounds"/>) within the node. - /// </summary> - /// <remarks> - /// The method expects the boundaries to be fully contained within the node. - /// </remarks> - /// - /// <param name="bounds">Boundaries contained within the node</param> - /// <returns>Relative internal position</returns> - IntraLocation Location(Bounds bounds); - - /// <summary> - /// Inserts item (<paramref name="item"/>) into the smallest node possible in the subtree. - /// </summary> - /// <remarks> - /// The method expects item boundaries to be fully contained within the node. - /// </remarks> - /// - /// <param name="item">Item to be inserted</param> - void Insert(TItem item); - - /// <summary> - /// Removes the provided item (<paramref name="item"/>) from the node and its subtree. - /// </summary> - /// - /// <param name="item">Item to be removed from the tree</param> - void Remove(TItem item); - - /// <summary> - /// Checks whether the node and recursively all its subnodes are empty. - /// </summary> - /// - /// <returns><c>True</c> if node and all its subnodes are empty, <c>False</c> otherwise</returns> - bool IsEmpty(); - - /// <summary> - /// Updates provided item's (<paramref name="item"/>) location within the tree. - /// </summary> - /// - /// <param name="item">Item which's location is to be updated</param> - /// <param name="forceInsertionEvaluation"><c>True</c> forces tree to re-insert the item</param> - /// <param name="hasOriginallyContainedItem"><c>True</c> only for the first called node</param> - void Update(TItem item, bool forceInsertionEvaluation = true, bool hasOriginallyContainedItem = true); - - /// <summary> - /// Finds items (<paramref name="items"/>) located within provided boundaries (<paramref name="bounds"/>). - /// </summary> - /// - /// <param name="bounds">Boundaries to look for items within</param> - /// <param name="items">Output list for found items</param> - void FindAndAddItems(Bounds bounds, ref IList<TItem> items); - - /// <summary> - /// Adds all items of this node and its sub-nodes to the provided list of items (<paramref name="items"/>). - /// If boundaries (<paramref name="bounds"/>) are provided then only items intersecting with them will be added. - /// </summary> - /// - /// <param name="items">Output list for found items</param> - /// <param name="bounds">Boundaries to look for items within</param> - void AddItems(ref IList<TItem> items, Bounds? bounds = null); - - /// <summary> - /// Removes any existing items from the node and removes all of its sub-nodes. - /// </summary> - void Clear(); - - /// <summary> - /// Displays boundaries of this node and all its sub-nodes and optinally a current number of contained items if <paramref name="displayNumberOfItems"/> is <c>True</c>. - /// </summary> - /// - /// <param name="displayNumberOfItems"><c>True</c> if number of node's items should be displayed</param> - void DrawBounds(bool displayNumberOfItems = false); - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs.meta deleted file mode 100644 index afbb4f4..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/INode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 098a425b4b0a1e74caf8d9ad90e81aab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs deleted file mode 100644 index c60c4ae..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Quadtree.Items; -using System.Collections.Generic; -using UnityEngine; - -namespace Quadtree -{ - /// <summary> - /// Main class of the Quadtree structure - it represents the root of the tree. - /// </summary> - public interface IQuadtreeRoot<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> - { - /// <summary> - /// The tree has been initialized and is ready to be used. - /// </summary> - bool Initialized { get; } - - /// <summary> - /// Node currently acting as a root of the tree. - /// </summary> - TNode CurrentRootNode { get; } - - /// <summary> - /// Minimum possible size of any of the nodes. - /// </summary> - /// <remarks> - /// Must always be a positive number or zero for no size limit. - /// </remarks> - float MinimumPossibleNodeSize { get; } - - /// <summary> - /// Determines whether or not should number of items in nodes be displayed in gizmos. - /// </summary> - bool DisplayNumberOfItemsInGizmos { get; } - - /// <summary> - /// Inserts item to the tree structure. - /// </summary> - /// - /// <param name="item">Item to be inserted</param> - void Insert(TItem item); - - /// <summary> - /// Expands size of root node. - /// New root node is created and current root node is assigned as its sub-node. - /// </summary> - void Expand(); - - /// <summary> - /// Finds items located within provided boundaries. - /// </summary> - /// - /// <param name="bounds">Boundaries to look for items within</param> - /// <returns>List of items found within provided boundaries</returns> - List<TItem> Find(Bounds bounds); - - /// <summary> - /// Removes provided item from the tree. - /// </summary> - /// - /// <param name="item">Item to be removed from the tree</param> - void Remove(TItem item); - - /// <summary> - /// Clears and resets the whole tree. - /// </summary> - void Clear(); - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs.meta deleted file mode 100644 index 747485d..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IQuadtreeRoot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 453574eb9f7ad7e4da47c8da2da0d111 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs deleted file mode 100644 index 45f4318..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs +++ /dev/null @@ -1,22 +0,0 @@ - -namespace Quadtree -{ - /// <summary> - /// Describes relative local position in respect to the current node. - /// </summary> - /// <remarks> - /// Integer values of <c>UPPER_LEFT</c>, <c>UPPER_RIGHT</c>, <c>LOWER_RIGHT</c>, <c>LOWER_LEFT</c> do correspond with the indices of the sub-nodes. - /// </remarks> - public enum IntraLocation - { - UPPER_LEFT, - UPPER_RIGHT, - LOWER_RIGHT, - LOWER_LEFT, - SPANNING_LEFT, - SPANNING_RIGHT, - SPANNING_UPPER, - SPANNING_LOWER, - SPANNING - }; -} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs.meta deleted file mode 100644 index 6425b68..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/IntraLocation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0dda602bfccb44b4681fbdb057709ea3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items.meta deleted file mode 100644 index 84bc356..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f4e8f6d51ba2a5e4f9813b5118761a9e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs deleted file mode 100644 index 7eaa418..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs +++ /dev/null @@ -1,10 +0,0 @@ - -using UnityEngine; - -namespace Quadtree.Items -{ - public abstract class GameObjectItem : GameObjectItemBase<GameObjectItem, Node<GameObjectItem>> - { - protected override GameObjectItem This() => this; - } -} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs.meta deleted file mode 100644 index a7c6b16..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3bb93ae6561edaa49a599f7ccf090da1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs deleted file mode 100644 index 9d1bada..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs +++ /dev/null @@ -1,152 +0,0 @@ -using UnityEngine; - -namespace Quadtree.Items -{ - /// <summary> - /// Custom item interface for GameObject quadtree items. - /// </summary> - public abstract class GameObjectItemBase<TItem, TNode> : MonoBehaviour, IItem<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> - { - /// <summary> - /// Game object's bounds from last update call. - /// </summary> - private Bounds _lastBounds; - - /// <summary> - /// Game object's bounds from last update call. - /// </summary> - private Bounds _safeBounds; - - //==========================================================================dd== - // MonoBehaviour METHODS - //==========================================================================dd== - - private void Start() - { - Init(); - } - - private void OnEnable() - { - Init(); - } - - private void OnDisable() - { - Root = null; - ItemInitialized = false; - ParentNode.Remove(This()); - } - - private void LateUpdate() - { - var currentBounds = GetBounds(); - if (currentBounds != _lastBounds) - { - // the object has moved or changed size - var forceInsertionEvaluation = false; - if (!currentBounds.Intersects(_safeBounds) - || (currentBounds.size - _lastBounds.size).magnitude > 0) - { - // ...far enough to force re-insertion - forceInsertionEvaluation = true; - _safeBounds = currentBounds; - } - - // current object bounds are not the same as last update - // initiate tree update from currently - ParentNode?.Update(This(), forceInsertionEvaluation); - _lastBounds = currentBounds; - } - } - - //==========================================================================dd== - // CORE TREE ITEM METHODS - //==========================================================================dd== - - /// <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; - - if (ItemInitialized) - { - // the item has been initialized before the tree root - root.Insert(This()); - } - } - - /// <summary> - /// Returns reference to corresponding game object. - /// </summary> - /// - /// <returns>Game object instance.</returns> - public abstract GameObject GetGameObject(); - - /// <summary> - /// Initializes the item instance. - /// </summary> - /// <remarks> - /// This may be called either before or after the initialization of the tree root. - /// </remarks> - protected virtual void Init() - { - // designate item as initialized - ItemInitialized = true; - - // set initial last bounds - _lastBounds = GetBounds(); - // set initial safe bounds - _safeBounds = _lastBounds; - - if (Root == null) - { - if (TryGetComponent(out GameObjectQuadtreeRoot quadtreeRoot) && quadtreeRoot.Initialized) - { - Root = (IQuadtreeRoot<TItem, TNode>)quadtreeRoot; - } - } - - if (Root != null) - { - // the tree root has been initialized before the item - Root.Insert(This()); - } - } - - /// <summary> - /// Overloaded in sub-classes to return correct instance of the item. - /// </summary> - /// <remarks> - /// This method is necessary due to generic typechecking -- <c>this</c> in context of the abstract generic class does not reference TItem itself. - /// </remarks> - /// - /// <returns>Instance of the item</returns> - protected abstract TItem This(); - - /// <summary> - /// Returns unique identifier of the item. - /// </summary> - /// <remarks> - /// It is extremely important to override this method because nodes are using HashSets to store items and the items are changing during the updates and so are the hash codes which can result in program not working properly. - /// </remarks> - /// - /// <returns>Unique identifier</returns> - public override int GetHashCode() - { - return GetInstanceID(); - } - } -} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs.meta deleted file mode 100644 index 16fd874..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/GameObjectItemBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 34e0c8684cc1c224a91b831b8c99c968 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs deleted file mode 100644 index 17a2f56..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; - -namespace Quadtree.Items -{ - /// <summary> - /// Mandatory interface of any quadtree item. - /// </summary> - public interface IItem<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode> - { - /// <summary> - /// Returns object bounds. - /// </summary> - /// - /// <returns>Object box bounds.</returns> - Bounds GetBounds(); - - /// <summary> - /// Node which currently contains the item. - /// </summary> - TNode ParentNode { get; set; } - - /// <summary> - /// Receiver method for broadcasted tree initialization message. - /// </summary> - void QuadTree_Root_Initialized(IQuadtreeRoot<TItem, TNode> root); - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs.meta deleted file mode 100644 index 059d630..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/IItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1e6be24bac4fd4a409194655d1cf0665 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs deleted file mode 100644 index 8d5f99d..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs +++ /dev/null @@ -1,46 +0,0 @@ -using UnityEngine; - -namespace Quadtree.Items -{ - /// <summary> - /// Boundaries of this quadtree item are determined by present <c>UnityEngine.Renderer</c> component. - /// </summary> - [ExecuteInEditMode] - [DisallowMultipleComponent] - [RequireComponent(typeof(Renderer))] - [AddComponentMenu("Spatial partitioning/Quadtree/Items/Renderer-based Item")] - public class RendererItem : GameObjectItem - { - /// <summary> - /// Determines whether the item should be automatically inserted into the tree upon its initialization. - /// </summary> - /// - /// <seealso cref="QuadtreeMonoRoot{TItem}.Insert(TItem)"/> - [SerializeField] - protected bool InsertOnInitialization = true; - - private Renderer _renderer; - - //==========================================================================dd== - // Quadtree ITEM METHODS - //==========================================================================dd== - - /// <summary> - /// Finds and locally stores this <c>GameObject</c>'s <c>Renderer</c> component instance. - /// </summary> - protected override void Init() - { - // load game object renderer component - _renderer = GetComponent<Renderer>(); - - base.Init(); - } - - public override Bounds GetBounds() - { - return _renderer.bounds; - } - - public override GameObject GetGameObject() => gameObject; - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs.meta deleted file mode 100644 index f259416..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Items/RendererItem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b92b133d7eeb95b4d95b27cf8ef679b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs deleted file mode 100644 index 787f7ee..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Quadtree.Items; - -namespace Quadtree -{ - /// <summary> - /// Single quadtree node. - /// </summary> - public class Node<TItem> : NodeBase<TItem, Node<TItem>> - where TItem : IItem<TItem, Node<TItem>> - { - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs.meta deleted file mode 100644 index ca7c953..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/Node.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6b7f771bc58948546801efab96121e12 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs deleted file mode 100644 index 82fb7d5..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs +++ /dev/null @@ -1,416 +0,0 @@ -using Quadtree.Items; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using UnityEditor; - -namespace Quadtree -{ - /// <summary> - /// Base quadtree node implementation. - /// </summary> - public abstract class NodeBase<TItem, TNode> : INode<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : NodeBase<TItem, TNode>, new() - { - public Bounds Bounds { get; set; } - - public TNode ParentNode { get; set; } - - public IList<TNode> SubNodes { get; set; } - - public IQuadtreeRoot<TItem, TNode> TreeRoot { get; set; } - - /// <summary> - /// List of inserted items. - /// </summary> - private readonly HashSet<TItem> _items; - - public NodeBase() - { - SubNodes = new List<TNode>(4); - _items = new HashSet<TItem>(); - } - - /// <summary> - /// Verifies whether provided boundaries (<paramref name="bounds"/>) are fully contained within the boundaries of the node. - /// </summary> - /// - /// <param name="bounds">Boundaries of an object</param> - /// <returns><c>True</c> if object is fully contained within the node, <c>False</c> otherwise</returns> - public bool Contains(Bounds bounds) => - bounds.min.x >= Bounds.min.x - && bounds.min.z >= Bounds.min.z - && bounds.max.x < Bounds.max.x - && bounds.max.z < Bounds.max.z; - - public IntraLocation Location(Bounds bounds) - { - if (bounds.min.z >= Bounds.center.z) - { - // items are located in top sub-nodes - if (bounds.max.x < Bounds.center.x) - { - // items are located in top left sub-node - return IntraLocation.UPPER_LEFT; - } - else if (bounds.min.x >= Bounds.center.x) - { - // items are located in top right sub-node - return IntraLocation.UPPER_RIGHT; - } - else - { - // item does not fit to either one, but is top - // (max.x is right, min.x is left) - return IntraLocation.SPANNING_UPPER; - } - } - else if (bounds.max.z < Bounds.center.z) - { - // items are located in bottom sub-nodes - if (bounds.max.x < Bounds.center.x) - { - // items are located in bottom left sub-node - return IntraLocation.LOWER_LEFT; - } - else if (bounds.min.x >= Bounds.center.x) - { - // items are located in bottom right sub-node - return IntraLocation.LOWER_RIGHT; - } - else - { - // item does not fit to either one, but is bottom - // (max.x is right, min.x is left) - return IntraLocation.SPANNING_LOWER; - } - } - else - { - // item does not fit to any sub-node - // (max.z is top, min.z is bottom) - if (bounds.min.x >= Bounds.center.x) - { - // bounds span over top right and bottom right nodes - return IntraLocation.SPANNING_RIGHT; - } - else if (bounds.max.x < Bounds.center.x) - { - // bounds span over top left and bottom left nodes - return IntraLocation.SPANNING_LEFT; - } - else - { - // bounds span over all sub-nodes - return IntraLocation.SPANNING; - } - } - } - - public void Insert(TItem item) - { - // create new sub-nodes - if (SubNodes.Count == 0) - CreateSubNodes(); - - // sub-nodes can not be created anymore - if (SubNodes.Count == 0) - { - // insert item into this node - _items.Add(item); - // and designate this node its parent - item.ParentNode = (TNode)this; - - return; - } - - var itemBounds = item.GetBounds(); - var itemBoundsLocation = Location(itemBounds); - switch (itemBoundsLocation) - { - // boundaries are contained within one of the subnodes - case IntraLocation.UPPER_LEFT: - case IntraLocation.UPPER_RIGHT: - case IntraLocation.LOWER_RIGHT: - case IntraLocation.LOWER_LEFT: - SubNodes[(int)itemBoundsLocation].Insert(item); - break; - - // boundaries are spanning over 2 or more subnodes - default: - _items.Add(item); - item.ParentNode = (TNode)this; - break; - } - } - - public void Remove(TItem item) - { - var itemBounds = item.GetBounds(); - var itemBoundsLocation = Location(itemBounds); - switch (itemBoundsLocation) - { - // boundaries are contained within one of the subnodes - case IntraLocation.UPPER_LEFT: - case IntraLocation.UPPER_RIGHT: - case IntraLocation.LOWER_RIGHT: - case IntraLocation.LOWER_LEFT: - SubNodes[(int)itemBoundsLocation].Remove(item); - break; - - // boundaries are spanning over 2 or more subnodes - default: - RemoveOwnItem(item); - break; - } - } - - /// <summary> - /// Removes provided item (<paramref name="item"/>) from the node. - /// </summary> - /// - /// <param name="item">Item to be removed from the node</param> - /// - /// <seealso cref="INode{TItem, TNode}.Clear"/> - protected internal void RemoveOwnItem(TItem item) - { - // remove the item from the node - _items.Remove(item); - // update its parent node - item.ParentNode = null; - - if (IsEmpty()) - { - // remove subnodes if subtree of this node is empty - SubNodes.Clear(); - } - } - - public bool IsEmpty() - { - if (_items.Count > 0) - return false; - - foreach (var subNode in SubNodes) - if (!subNode.IsEmpty()) - return false; - - return true; - } - - public void Update(TItem item, bool forceInsertionEvaluation = true, bool hasOriginallyContainedItem = true) - { - if (Contains(item.GetBounds())) - { - // item is contained by this node - if (hasOriginallyContainedItem) - { - // ...and this node has originally contained the item - if (forceInsertionEvaluation) - { - // ...and insertion evaluation is forced - // this checks whether the item hasn't moved into any of the subnodes - RemoveOwnItem(item); - Insert(item); - } - - // item is still contained by its original node, no action necessary - return; - } - - // ...but this node is not its original container - // insert item either to this node or any of its children - Insert(item); - - // update has been successful - return; - } - - // the item is not contained by this node - if (ParentNode == null) - { - // ...and this node does not have any parent - the tree must be expanded - TreeRoot.Expand(); - if (ParentNode == null) - { - // the expansion has failed for some reason - Debug.LogError("Tree root expansion failed for item " + item.ToString()); - return; - } - } - - // the item is not contained by this node - if (hasOriginallyContainedItem) - { - // ...and this node has originally contained the item - it must be removed - RemoveOwnItem(item); - } - - // parent is (now) available - ParentNode.Update(item, forceInsertionEvaluation, false); - // the item is now contained by another node, update has been successful - } - - /// <summary> - /// Creates sub-nodes for the node. - /// </summary> - protected internal void CreateSubNodes() - { - var subBoundsSize = Bounds.size * .5f; - if (subBoundsSize.x < TreeRoot.MinimumPossibleNodeSize - || subBoundsSize.z < TreeRoot.MinimumPossibleNodeSize) - { - // new sub-node bounds are too small - return; - } - - var centerOffset = subBoundsSize * .5f; - - // top left node [-x +z] - centerOffset.x *= -1f; - SubNodes.Insert((int)IntraLocation.UPPER_LEFT, new TNode() - { - TreeRoot = TreeRoot, - ParentNode = (TNode)this, - Bounds = new Bounds(Bounds.center + centerOffset, subBoundsSize), - }); - - // top right node [+x +z] - centerOffset.x *= -1f; - SubNodes.Insert((int)IntraLocation.UPPER_RIGHT, new TNode() - { - TreeRoot = TreeRoot, - ParentNode = (TNode)this, - Bounds = new Bounds(Bounds.center + centerOffset, subBoundsSize), - }); - - // bottom right node [+x -z] - centerOffset.z *= -1f; - SubNodes.Insert((int)IntraLocation.LOWER_RIGHT, new TNode() - { - TreeRoot = TreeRoot, - ParentNode = (TNode)this, - Bounds = new Bounds(Bounds.center + centerOffset, subBoundsSize), - }); - - // bottom left node [-x -z] - centerOffset.x *= -1f; - SubNodes.Insert((int)IntraLocation.LOWER_LEFT, new TNode() - { - TreeRoot = TreeRoot, - ParentNode = (TNode)this, - Bounds = new Bounds(Bounds.center + centerOffset, subBoundsSize), - }); - } - - public void FindAndAddItems(Bounds bounds, ref IList<TItem> items) - { - if (SubNodes.Count == 0) - { - // no sub-nodes exist - AddOwnItems(ref items); - return; - } - - // always add any items in this node intersecting with the boundaries - AddOwnItems(ref items, bounds); - - var boundsLocation = Location(bounds); - switch (boundsLocation) - { - // boundaries are contained within one of the subnodes - case IntraLocation.UPPER_LEFT: - case IntraLocation.UPPER_RIGHT: - case IntraLocation.LOWER_RIGHT: - case IntraLocation.LOWER_LEFT: - SubNodes[(int)boundsLocation].FindAndAddItems(bounds, ref items); - break; - - // boundaries are spanning over left subnodes - case IntraLocation.SPANNING_LEFT: - SubNodes[(int)IntraLocation.UPPER_LEFT].AddItems(ref items, bounds); - SubNodes[(int)IntraLocation.LOWER_LEFT].AddItems(ref items, bounds); - break; - - // boundaries are spanning over right subnodes - case IntraLocation.SPANNING_RIGHT: - SubNodes[(int)IntraLocation.UPPER_RIGHT].AddItems(ref items, bounds); - SubNodes[(int)IntraLocation.LOWER_RIGHT].AddItems(ref items, bounds); - break; - - // boundaries are spanning over upper subnodes - case IntraLocation.SPANNING_UPPER: - SubNodes[(int)IntraLocation.UPPER_LEFT].AddItems(ref items, bounds); - SubNodes[(int)IntraLocation.UPPER_RIGHT].AddItems(ref items, bounds); - break; - - // boundaries are spanning over lower subnodes - case IntraLocation.SPANNING_LOWER: - SubNodes[(int)IntraLocation.LOWER_LEFT].AddItems(ref items, bounds); - SubNodes[(int)IntraLocation.LOWER_RIGHT].AddItems(ref items, bounds); - break; - - // boundaries are spanning over all subnodes - case IntraLocation.SPANNING: - default: - AddSubNodeItems(ref items, bounds); - break; - } - } - - public void AddItems(ref IList<TItem> items, Bounds? bounds = null) - { - AddOwnItems(ref items, bounds); - AddSubNodeItems(ref items, bounds); - } - - /// <summary> - /// Adds all items belonging to this node (ignoring sub-nodes) to the provided list of items (<paramref name="items"/>). - /// If boundaries (<paramref name="bounds"/>) are provided then only items intersecting with them will be added. - /// </summary> - /// - /// <param name="items">Output list for found items</param> - /// <param name="bounds">Boundaries to look for items within</param> - protected internal void AddOwnItems(ref IList<TItem> items, Bounds? bounds = null) - { - var itemSource = bounds != null - ? _items.Where(item => item.GetBounds().Intersects((Bounds)bounds)) - : _items; - - foreach (var item in itemSource) - { - items.Add(item); - } - } - - /// <summary> - /// Adds all items belonging to sub-nodes (ignoring own items) to the provided list of items (<paramref name="items"/>). - /// If boundaries (<paramref name="bounds"/>) are provided then only items intersecting with them will be added. - /// </summary> - /// - /// <param name="items">Output list for found items</param> - /// <param name="bounds">Boundaries to look for items within</param> - protected internal void AddSubNodeItems(ref IList<TItem> items, Bounds? bounds = null) - { - foreach (var subNode in SubNodes) - subNode.AddItems(ref items, bounds); - } - - public void Clear() - { - _items.Clear(); - SubNodes.Clear(); - } - - public void DrawBounds(bool displayNumberOfItems = false) - { - if (displayNumberOfItems) - Handles.Label(Bounds.center, _items.Count.ToString()); - - Gizmos.DrawWireCube(Bounds.center, Bounds.size); - foreach (var subNode in SubNodes) - subNode.DrawBounds(displayNumberOfItems); - } - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs.meta deleted file mode 100644 index fb7b948..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/NodeBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d4fcbd58d7420b641ba4525095243edc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs deleted file mode 100644 index 77a8eec..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Quadtree.Items; -using System.Collections.Generic; -using UnityEngine; - -namespace Quadtree -{ - /// <summary> - /// Main class of the Quadtree structure - it represents the root of the tree. - /// </summary> - public abstract class QuadtreeMonoRoot<TItem, TNode> : MonoBehaviour, IQuadtreeRoot<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode>, new() - { - //==========================================================================dd== - // MonoBehaviour METHODS - //==========================================================================dd== - - protected void Start() - { - Init(); - } - - protected void OnEnable() - { - Init(); - } - - protected void OnDrawGizmos() - { - DrawBounds(); - } - - //==========================================================================dd== - // CORE ROOT NODE METHODS - //==========================================================================dd== - - /// <summary> - /// Root node containing all items and sub-nodes. - /// </summary> - protected QuadtreeRoot<TItem, TNode> TreeRoot = null; - - public bool Initialized => TreeRoot != null && TreeRoot.Initialized; - - public TNode CurrentRootNode => TreeRoot.CurrentRootNode; - - [SerializeField] - protected Vector3 DefaultRootNodeSize = new Vector3(64f, 0f, 64f); - - /// <inheritdoc cref="IQuadtreeRoot{TItem, TNode}.MinimumPossibleNodeSize"/> - [SerializeField] - protected float MinimumPossibleNodeSize = 1f; - - float IQuadtreeRoot<TItem, TNode>.MinimumPossibleNodeSize => MinimumPossibleNodeSize; - - /// <inheritdoc cref="IQuadtreeRoot{TItem, TNode}.DisplayNumberOfItemsInGizmos"/> - [SerializeField] - private bool DisplayNumberOfItemsInGizmos = false; - - bool IQuadtreeRoot<TItem, TNode>.DisplayNumberOfItemsInGizmos => DisplayNumberOfItemsInGizmos; - - /// <summary> - /// Initializes Quadtree - creates initial root node and builds the tree (if allowed). - /// </summary> - /// - /// <seealso cref="IItem{TItem, TNode}.QuadTree_Root_Initialized(IQuadtreeRoot{TItem, TNode})"/> - protected void Init() - { - if (TreeRoot == null) - { - TreeRoot = new QuadtreeRoot<TItem, TNode>(transform.position, DefaultRootNodeSize); - } - else - { - // root node has already been initialized, clear the tree - TreeRoot.Clear(); - } - - // send a message to children that the tree root has been initialized - BroadcastMessage("QuadTree_Root_Initialized", this, SendMessageOptions.DontRequireReceiver); - } - - /// <summary> - /// Displays Quadtree node boundaries. - /// </summary> - /// - /// <seealso cref="INode{TItem, TNode}.DrawBounds(bool)"/> - protected void DrawBounds() - { - TreeRoot?.CurrentRootNode.DrawBounds(DisplayNumberOfItemsInGizmos); - } - - public void Insert(TItem item) => TreeRoot.Insert(item); - - public void Expand() => TreeRoot.Expand(); - - public List<TItem> Find(Bounds bounds) => TreeRoot.Find(bounds); - - public void Remove(TItem item) => TreeRoot.Remove(item); - - public void Clear() => TreeRoot.Clear(); - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs.meta deleted file mode 100644 index 4f81066..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeMonoRoot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75bed756428fd8a418c2145ab40ffd3c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs deleted file mode 100644 index 7d79a4e..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs +++ /dev/null @@ -1,148 +0,0 @@ -using Quadtree.Items; -using System.Collections.Generic; -using UnityEngine; - -namespace Quadtree -{ - /// <summary> - /// Main class of the Quadtree structure - it represents the root of the tree. - /// </summary> - public class QuadtreeRoot<TItem, TNode> : IQuadtreeRoot<TItem, TNode> - where TItem : IItem<TItem, TNode> - where TNode : INode<TItem, TNode>, new() - { - public bool Initialized { get; set; } - - public TNode CurrentRootNode { get; internal set; } - - public float MinimumPossibleNodeSize => _minimumPossibleNodeSize; - - /// <inheritdoc cref="IQuadtreeRoot{TItem}.MinimumPossibleNodeSize"/> - protected float _minimumPossibleNodeSize = 1f; - - public bool DisplayNumberOfItemsInGizmos => _displayNumberOfItemsInGizmos; - - /// <inheritdoc cref="IQuadtreeRoot{TItem}.DisplayNumberOfItemsInGizmos"/> - protected bool _displayNumberOfItemsInGizmos = false; - - /// <summary> - /// Determines side of root node expansion if necessary. - /// </summary> - protected bool ExpansionRight = true; - - /// <summary> - /// Initializes Quadtree - creates initial root node and builds the tree (if allowed). - /// </summary> - public QuadtreeRoot(Vector3 center, Vector3 size) - { - CurrentRootNode = new TNode - { - TreeRoot = this, - ParentNode = default, - Bounds = new Bounds(center, size), - }; - Initialized = true; - } - - public void Insert(TItem item) - { - // get item bounds - var itemBounds = item.GetBounds(); - - // expand root node if necessary - while (!CurrentRootNode.Contains(itemBounds)) - Expand(); - - // insert item into the tree - CurrentRootNode.Insert(item); - } - - public void Expand() - { - // the subnodes will be of the same size as current root node - var subBoundsSize = CurrentRootNode.Bounds.size; - var centerOffset = subBoundsSize * .5f; - - // center if expanding to left - var center = CurrentRootNode.Bounds.min; - if (ExpansionRight) - { - // center if expanding to right - center = CurrentRootNode.Bounds.max; - } - - var subNodes = new List<TNode>(4); - var newRootNode = new TNode - { - TreeRoot = this, - ParentNode = default, - Bounds = new Bounds(center, subBoundsSize * 2f), - SubNodes = subNodes, - }; - CurrentRootNode.ParentNode = newRootNode; - - // top left node [-x +y] - centerOffset.x *= -1f; - subNodes.Insert((int)IntraLocation.UPPER_LEFT, new TNode - { - TreeRoot = this, - ParentNode = newRootNode, - Bounds = new Bounds(center + centerOffset, subBoundsSize), - }); - - // top right node [+x +y] - centerOffset.x *= -1f; - subNodes.Insert((int)IntraLocation.UPPER_RIGHT, !ExpansionRight - ? CurrentRootNode - : new TNode - { - TreeRoot = this, - ParentNode = newRootNode, - Bounds = new Bounds(center + centerOffset, subBoundsSize), - }); - - // bottom right node [+x -y] - centerOffset.z *= -1f; - subNodes.Insert((int)IntraLocation.LOWER_RIGHT, new TNode - { - TreeRoot = this, - ParentNode = newRootNode, - Bounds = new Bounds(center + centerOffset, subBoundsSize), - }); - - // bottom left node [-x -y] - centerOffset.x *= -1f; - subNodes.Insert((int)IntraLocation.LOWER_LEFT, ExpansionRight - ? CurrentRootNode - : new TNode - { - TreeRoot = this, - ParentNode = newRootNode, - Bounds = new Bounds(center + centerOffset, subBoundsSize), - }); - - // assign new root node - CurrentRootNode = newRootNode; - // toggle expansion side for next expansion - ExpansionRight = !ExpansionRight; - } - - public List<TItem> Find(Bounds bounds) - { - IList<TItem> itemList = new List<TItem>(); - CurrentRootNode.FindAndAddItems(bounds, ref itemList); - - return (List<TItem>)itemList; - } - - public void Remove(TItem item) - { - CurrentRootNode.Remove(item); - } - - public void Clear() - { - CurrentRootNode.Clear(); - } - } -}
\ No newline at end of file diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs.meta b/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs.meta deleted file mode 100644 index 0909866..0000000 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/QuadtreeRoot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04323cce92d745049b0ed48ae4f02979 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/marching/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs b/marching/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs index a93c293..ce321d3 100644 --- a/marching/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs +++ b/marching/Assets/Scripts/Unit/Characters/Samurai/SamuraiScript.cs @@ -1,7 +1,6 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using static UnityEditor.PlayerSettings; namespace MH { diff --git a/marching/Assets/Scripts/Unit/Enemies/SpiritScript.cs b/marching/Assets/Scripts/Unit/Enemies/SpiritScript.cs index 3df5e4b..d33b494 100644 --- a/marching/Assets/Scripts/Unit/Enemies/SpiritScript.cs +++ b/marching/Assets/Scripts/Unit/Enemies/SpiritScript.cs @@ -11,36 +11,81 @@ public class SpiritScript : UnitBase public Item_Coin coinPrefab; public int count = 0; + public float avg = 0; private FastCircleCollider collider; private static List<IQuadTreeObject> collisions = new List<IQuadTreeObject>(); + private SpriteRenderer m_SpriteRenderer; + + private int m_CollisionCheckerCount = 0; + + private static int sCount = 0; + private static float sAvg = 0; + protected override void Awake() { base.Awake(); collider = GetComponent<FastCircleCollider>(); + m_SpriteRenderer = GetComponent<SpriteRenderer>(); } protected override void Update() { base.Update(); + } + + private void FixedUpdate() + { UnitBase hero = UnitManager.hero; Vector2 pos = transform.position; Vector2 heroPos = hero.transform.position; Vector2 dir = (heroPos - pos).normalized; - pos += dir * Time.deltaTime * speed; - this.GetComponent<SpriteRenderer>().flipX = dir.x < 0; + Vector2 dist = dir * Time.deltaTime * speed; // Î»ÒÆ + m_SpriteRenderer.flipX = dir.x < 0; collisions.Clear(); - if (TestQuadtree.quadtree.Retrieve(ref collisions, collider)) + + bool bCollide = false; + if (m_CollisionCheckerCount == 0 && TestQuadtree.quadtree.Retrieve(ref collisions, collider)) { count = collisions.Count; + sAvg = (sCount * sAvg + count) / (float)(sCount + 1); + avg = sAvg; + sCount++; + bool movable = true; + Vector2 seperate = new Vector2(); + for (int i = 0; i < collisions.Count; ++i) + { + FastCircleCollider col = collisions[i] as FastCircleCollider; + if (col == collider) + continue; + if (PhysicsManager.CircleVsCircle(col.center, col.radius, collider.center, collider.radius)) + { + bCollide = true; + movable = false; + Vector2 distance = collider.center - col.center; + seperate = distance.normalized * (col.radius + collider.radius - distance.magnitude); // + dist += seperate; + dist -= (distance.normalized * dist) * distance.normalized; // È¥³ýÕâ¸ö·½ÏòµÄÎ»ÒÆ + } + } + if (!movable) + { + } + } + if (bCollide) + { + m_CollisionCheckerCount = 0; } else { - transform.position = pos; + m_CollisionCheckerCount++; + m_CollisionCheckerCount %= 10; } + dist = dist.normalized * Time.deltaTime * speed; // ±£³ÖÔËÙ + transform.position += dist.ToVector3(); } public void Die() diff --git a/marching/Assets/Scripts/Utils/FPSScript.cs b/marching/Assets/Scripts/Utils/FPSScript.cs new file mode 100644 index 0000000..9c9a444 --- /dev/null +++ b/marching/Assets/Scripts/Utils/FPSScript.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using UnityEngine.UI; +using System.Collections; + +namespace FBCapture +{ + public class FPSScript : MonoBehaviour + { + /// <summary> + /// Delta time + /// </summary> + float deltaTime = 0.0f; + + /// <summary> + /// It will be used for printing out fps text on screen + /// </summary> + Text text; + + void Start() + { + text = GetComponent<Text>(); + } + + void Update() + { + deltaTime += (Time.deltaTime - deltaTime) * 0.1f; + float msec = deltaTime * 1000.0f; + float fps = 1.0f / deltaTime; + text.text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps); + } + } + +} diff --git a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectQuadtreeRoot.cs.meta b/marching/Assets/Scripts/Utils/FPSScript.cs.meta index 88c8393..d6119a8 100644 --- a/marching/Assets/Scripts/Physics/unity-quadtree-master/Scripts/GameObjectQuadtreeRoot.cs.meta +++ b/marching/Assets/Scripts/Utils/FPSScript.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2ec46052397248d478fc24737435f7a9 +guid: db0f6a04d6782e54bafd5a1865a0dae5 MonoImporter: externalObjects: {} serializedVersion: 2 |