private Vector3 revertToOrigin(Vector3 loc) { Vector2 temp = new Vector2(loc.x, loc.z); temp = VectorCalculation.revertToOrigin(temp, GameMode.getCurrentLevel()); return(makeVector3(temp)); }
public bool canSet(int x, int y, Block block, float deg = 0) { Vector2 start = new Vector2(x, y); if (grid == null) { clear(); } Vector2 calc = VectorCalculation.revertToOrigin(start, this); if (calc.x >= getWidth() || calc.y >= getHeight()) { return(false); } Vector2 least = getLeast(block, deg); foreach (Vector2 col in block.getCollision()) { Vector2 temp = getGridPoint(col, start, least, deg); if (temp.x >= getWidth() || temp.y >= getHeight() || getPos(temp) != null) { return(false); } } return(true); }
private void setParent() { GameObject empty = new GameObject(); Vector3 dir = new Vector3(); switch (data [current].flipFrom) { case Direction.UP: dir = new Vector3(0, 0, .5f); break; case Direction.LEFT: dir = new Vector3(-0.5f, 0, 0); break; case Direction.BOTTOM: dir = new Vector3(0, 0, -0.5f); break; case Direction.RIGHT: dir = new Vector3(0.5f, 0, 0); break; } Vector3 lastPos = makeVector3(VectorCalculation.revertToOrigin(data [current].Position, GameMode.getCurrentLevel())) + dir * -1; lastPos.y = 0.1f; empty.transform.position = lastPos; getPrefab().transform.position = new Vector3(0, 0, 0); getPrefab().transform.eulerAngles = new Vector3(0, data [current].getRotation(), 0); getPrefab().transform.parent = empty.transform; getPrefab().transform.localPosition = dir; empty.transform.eulerAngles = getRotation() * -180; }
private Vector2 getGridPoint(Vector2 col, Vector2 start, Vector2 least, float deg) { Vector2 temp = start + VectorCalculation.rotateVector(col, deg) + least; return(VectorCalculation.revertToOrigin(temp, this)); }
private void displayRoadPoints() { placeRoad(VectorCalculation.revertToOrigin(level.getFinish(), level)); placeRoad(VectorCalculation.revertToOrigin(level.getStart(), level)); }