Skip to content
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

Open
wants to merge 37 commits into
base: development
Choose a base branch
from
Open

Feature/pathfinding #21

wants to merge 37 commits into from

Conversation

Shortyoo
Copy link
Collaborator

@Shortyoo Shortyoo commented Jul 7, 2020

Look what we've done!

using UnityEngine;

namespace Assets.Scripts.Pathfinding
{
public sealed class Edge
{
public Edge(Vertex target, float cost)
public Edge(Vertex target, Vertex start, float cost)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space

Vector2 directionVectorScondeEdge = endPoint - startPoint;


float t1; // aus x = p0 + t * a (x p0 und a sind Vektoren)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translate comment to english

float t1; // aus x = p0 + t * a (x p0 und a sind Vektoren)
float t2;

float anstiegScondeEdge;
Copy link
Owner

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"


//IF Intersection bestimmen
//kontrolle auf paralelität
if ( Math.Abs(anstiegScondeEdge) == Math.Abs(_anstieg))
Copy link
Owner

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
}
else
{
if (_directionVector.y == 0)
Copy link
Owner

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)

{
if (_directionVector.y == 0)
{
throw new Exception("Direction Vektor is null Vektor!!");
Copy link
Owner

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

@@ -14,13 +14,15 @@ protected Vertex(Vector2 position)
Position = position;
}

public Vector2 Position { get; }
public UnityEngine.Vector2 Position { get; }
Copy link
Owner

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
Copy link
Owner

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)
Copy link
Owner

@dviererbe dviererbe Jul 7, 2020

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.

Copy link
Owner

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,
Copy link
Owner

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;
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants