-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/pathfinding #21
base: development
Are you sure you want to change the base?
Conversation
…rbe/SVENSimulation into feature/Pathfinding
This reverts commit 1554a32.
using UnityEngine; | ||
|
||
namespace Assets.Scripts.Pathfinding | ||
{ | ||
public sealed class Edge | ||
{ | ||
public Edge(Vertex target, float cost) | ||
public Edge(Vertex target, Vertex start, float cost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space
Assets/Scripts/Pathfinding/Edge.cs
Outdated
Vector2 directionVectorScondeEdge = endPoint - startPoint; | ||
|
||
|
||
float t1; // aus x = p0 + t * a (x p0 und a sind Vektoren) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
translate comment to english
Assets/Scripts/Pathfinding/Edge.cs
Outdated
float t1; // aus x = p0 + t * a (x p0 und a sind Vektoren) | ||
float t2; | ||
|
||
float anstiegScondeEdge; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename variable name to english an remove typo "Sconde" to "Second"
Assets/Scripts/Pathfinding/Edge.cs
Outdated
|
||
//IF Intersection bestimmen | ||
//kontrolle auf paralelität | ||
if ( Math.Abs(anstiegScondeEdge) == Math.Abs(_anstieg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename _anstieg to english name
Added comment
Assets/Scripts/Pathfinding/Edge.cs
Outdated
} | ||
else | ||
{ | ||
if (_directionVector.y == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
floating point numbers are not directly compared to another floating point value
use Epsilon Neighbourhood (https://en.wikipedia.org/wiki/Neighbourhood_(mathematics))
possible implementation:
if (Mathf.Abs(_directionVector.y) < 0.01)
Assets/Scripts/Pathfinding/Edge.cs
Outdated
{ | ||
if (_directionVector.y == 0) | ||
{ | ||
throw new Exception("Direction Vektor is null Vektor!!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate Exception Message to english
Assets/Scripts/Pathfinding/Vertex.cs
Outdated
@@ -14,13 +14,15 @@ protected Vertex(Vector2 position) | |||
Position = position; | |||
} | |||
|
|||
public Vector2 Position { get; } | |||
public UnityEngine.Vector2 Position { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why UnityEngine.Vector2 ?
Changed UnityEngine.Vector2 to Vector2
@@ -242,12 +251,38 @@ void Start() | |||
} | |||
} | |||
} | |||
#endregion | |||
|
|||
#region WallVertexFüttern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate to english
|
||
#endregion | ||
|
||
#region RoomObjects Creator | ||
|
||
foreach(RoomObjects obj in roomObjects) | ||
foreach (RoomObjects obj in roomObjects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not rename variable obj to roomObject? This whould clear up the meaning what this variable does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename class RoomObjects to RoomObject, becuase one instance just stores one object and not multiple. Name would imply that one instance can store multiple objects.
@@ -256,8 +291,8 @@ void Start() | |||
roomObject = Instantiate( | |||
_chairPrefab, //the GameObject that will be instantiated | |||
position: new Vector3( | |||
x: (WallThickness + obj.PosY) + 0.5f, | |||
y: (WallThickness + obj.PosX) + 0.5f), | |||
x: (WallThickness + obj.PosX) + 0.5f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename PosX to "PositionX" or "XPosition" and PosY to "PositionY" or "YPosition" to clear up the meaning of the variable
{ | ||
get | ||
{ | ||
return Rotation * Math.PI / 180; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Mathf.PI instead. It takes time for the cpu to switch between the floting point precision double and float an to convert double to float
… thermodynamics) overheating problem
…onal RoomElementType Tablet
Look what we've done!