Skip to content

Package #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
**/Library/
**/Temp/
**/obj/

*~
.DS_Store
.npmrc
.idea/
npm-debug.log
!Documentation~
!Samples~
**/.vscode/
**/.vs

**/Assets/Plugins/*
**/Assets/Plugins.meta

*.idea
*.csproj
*.sln
*.suo
*.userprefs
*.app
*.VC.*
.DS_Store
*~
*.swp

.vs/
build/*
*.rsp
*.pyc
/Logs
*.bak
*.bak.meta
9 changes: 0 additions & 9 deletions Assets/NavMeshComponents.meta

This file was deleted.

54 changes: 0 additions & 54 deletions Assets/NavMeshComponents/Scripts/NavMeshModifier.cs

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.1.0-preview.2] - 2020-12-08

This is the first release of the *NavMesh Components* repository in the form of a Unity package.

### Changes
* The [license](LICENSE.md) has changed.
* The folder structure has changed in accordance to the requirements of the Unity standards for packages.
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

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

2 changes: 1 addition & 1 deletion Documentation/README.md → Documentation~/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Here we introduce four high level components for the navigation system:
These components comprise the high level controls for building and using NavMeshes at runtime as well as edit time.

## Techniques and Patterns
* [Connecting NavMesh Surfaces](ConnectingSurfaces.md) using the NavMeshLink compoenent.
* [Connecting NavMesh Surfaces](ConnectingSurfaces.md) using the NavMeshLink component.


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace UnityEditor.AI
{
/// <summary>
/// Manages assets and baking operation of the navmesh
/// </summary>
public class NavMeshAssetManager : ScriptableSingleton<NavMeshAssetManager>
{
internal struct AsyncBakeOperation
Expand Down Expand Up @@ -108,6 +111,10 @@ void ClearSurface(NavMeshSurface navSurface)
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assetToDelete));
}

/// <summary>
/// Start baking a list of NavMeshSurface
/// </summary>
/// <param name="surfaces">List of surfaces</param>
public void StartBakingSurfaces(UnityEngine.Object[] surfaces)
{
// Remove first to avoid double registration of the callback
Expand Down Expand Up @@ -164,6 +171,11 @@ void UpdateAsyncBuildOperations()
EditorApplication.update -= UpdateAsyncBuildOperations;
}

/// <summary>
/// Checks if an operation of baking is in progress for a specified surface
/// </summary>
/// <param name="surface">A navmesh surface</param>
/// <returns>True if the specified surface is baking</returns>
public bool IsSurfaceBaking(NavMeshSurface surface)
{
if (surface == null)
Expand All @@ -181,6 +193,10 @@ public bool IsSurfaceBaking(NavMeshSurface surface)
return false;
}

/// <summary>
/// Clear navmesh surfaces
/// </summary>
/// <param name="surfaces">List of surfaces</param>
public void ClearSurfaces(UnityEngine.Object[] surfaces)
{
foreach (NavMeshSurface s in surfaces)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

namespace UnityEditor.AI
{
/// <summary> Class containing a set of utility functions meant for presenting information from the NavMeshComponents into the GUI. </summary>
public static class NavMeshComponentsGUIUtility
{
/// <summary> Displays a GUI element for selecting the area type used by a <see cref="NavMeshSurface"/>, <see cref="NavMeshLink"/>, <see cref="NavMeshModifier"/> or <see cref="NavMeshModifierVolume"/>. </summary>
/// <param name="labelName"></param>
/// <param name="areaProperty"></param>
public static void AreaPopup(string labelName, SerializedProperty areaProperty)
{
var areaIndex = -1;
Expand Down Expand Up @@ -35,6 +39,9 @@ public static void AreaPopup(string labelName, SerializedProperty areaProperty)
EditorGUI.EndProperty();
}

/// <summary> Displays a GUI element for selecting the agent type used by a <see cref="NavMeshSurface"/> or <see cref="NavMeshLink"/>. </summary>
/// <param name="labelName"></param>
/// <param name="agentTypeID"></param>
public static void AgentTypePopup(string labelName, SerializedProperty agentTypeID)
{
var index = -1;
Expand Down Expand Up @@ -82,6 +89,9 @@ public static void AgentTypePopup(string labelName, SerializedProperty agentType
// It is used to describe which agents modifiers apply to.
// There is a special case of "None" which is an empty array.
// There is a special case of "All" which is an array of length 1, and value of -1.
/// <summary> Displays a GUI element for selecting multiple agent types for which a <see cref="NavMeshModifier"/> or <see cref="NavMeshModifierVolume"/> can influence the NavMesh. </summary>
/// <param name="labelName"></param>
/// <param name="agentMask"></param>
public static void AgentMaskPopup(string labelName, SerializedProperty agentMask)
{
// Contents of the dropdown box.
Expand Down Expand Up @@ -127,6 +137,10 @@ public static void AgentMaskPopup(string labelName, SerializedProperty agentMask
EditorGUI.EndProperty();
}

/// <summary> Creates a new GameObject as a child of another one and selects it immediately. </summary>
/// <param name="suggestedName"></param>
/// <param name="parent"></param>
/// <returns></returns>
public static GameObject CreateAndSelectGameObject(string suggestedName, GameObject parent)
{
var parentTransform = parent != null ? parent.transform : null;
Expand All @@ -142,11 +156,16 @@ public static GameObject CreateAndSelectGameObject(string suggestedName, GameObj
return child;
}

/// <summary> Checks whether a serialized property has all the bits set when intepreted as a bitmask. </summary>
/// <param name="agentMask"></param>
/// <returns></returns>
static bool IsAll(SerializedProperty agentMask)
{
return agentMask.arraySize == 1 && agentMask.GetArrayElementAtIndex(0).intValue == -1;
}

/// <summary> Marks one agent type as being selected or not. </summary>
/// <param name="userData"></param>
static void ToggleAgentMaskItem(object userData)
{
var args = (object[])userData;
Expand All @@ -157,6 +176,10 @@ static void ToggleAgentMaskItem(object userData)
ToggleAgentMaskItem(agentMask, agentTypeID, value);
}

/// <summary> Marks one agent type as being selected or not. </summary>
/// <param name="agentMask"></param>
/// <param name="agentTypeID"></param>
/// <param name="value"></param>
static void ToggleAgentMaskItem(SerializedProperty agentMask, int agentTypeID, bool value)
{
if (agentMask.hasMultipleDifferentValues)
Expand Down Expand Up @@ -200,13 +223,17 @@ static void ToggleAgentMaskItem(SerializedProperty agentMask, int agentTypeID, b
agentMask.serializedObject.ApplyModifiedProperties();
}

/// <summary> Marks all agent types as not being selected. </summary>
/// <param name="data"></param>
static void SetAgentMaskNone(object data)
{
var agentMask = (SerializedProperty)data;
agentMask.ClearArray();
agentMask.serializedObject.ApplyModifiedProperties();
}

/// <summary> Marks all agent types as being selected. </summary>
/// <param name="data"></param>
static void SetAgentMaskAll(object data)
{
var agentMask = (SerializedProperty)data;
Expand All @@ -216,6 +243,9 @@ static void SetAgentMaskAll(object data)
agentMask.serializedObject.ApplyModifiedProperties();
}

/// <summary> Obtains one string that represents the current selection of agent types. </summary>
/// <param name="agentMask"></param>
/// <returns> One string that represents the current selection of agent types.</returns>
static string GetAgentMaskLabelName(SerializedProperty agentMask)
{
if (agentMask.arraySize == 0)
Expand Down Expand Up @@ -244,6 +274,10 @@ static string GetAgentMaskLabelName(SerializedProperty agentMask)
return "Mixed...";
}

/// <summary> Checks whether a certain agent type is selected. </summary>
/// <param name="agentMask"></param>
/// <param name="agentTypeID"></param>
/// <returns></returns>
static bool AgentMaskHasSelectedAgentTypeID(SerializedProperty agentMask, int agentTypeID)
{
for (var j = 0; j < agentMask.arraySize; j++)
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

5 changes: 5 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
com.unity.ai.navigation.components copyright © 2016 Unity Technologies ApS

Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license).

Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
7 changes: 7 additions & 0 deletions LICENSE.md.meta

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

40 changes: 0 additions & 40 deletions Packages/manifest.json

This file was deleted.

16 changes: 0 additions & 16 deletions ProjectSettings/AudioManager.asset

This file was deleted.

6 changes: 0 additions & 6 deletions ProjectSettings/ClusterInputManager.asset

This file was deleted.

Loading