Add location of cars within the trainset the user is in
Slight tidy up
This commit is contained in:
1 parent
55dfd09550
commit
8daf861088
7 files changed
+79
-11
No files matched your search
@@ -1,21 +1,34 @@
|
||||
using UnityEngine;
|
||||
using DV.OriginShift;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CommunityMapLocation.Api.Location
|
||||
{
|
||||
public class LocationResponse
|
||||
{
|
||||
public LocationResponse(Vector3 position, float rotation)
|
||||
public LocationResponse(Transform playerTransform, bool reverse)
|
||||
{
|
||||
var position = playerTransform.AbsolutePosition();
|
||||
|
||||
X = position.x;
|
||||
Y = position.y;
|
||||
Z = position.z;
|
||||
|
||||
Rotation = rotation;
|
||||
var angle = playerTransform.rotation.eulerAngles.y;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
angle += 180;
|
||||
}
|
||||
|
||||
Rotation = angle * (Mathf.PI / 180);
|
||||
}
|
||||
|
||||
public float X { get; }
|
||||
public float Y { get; }
|
||||
public float Z { get; }
|
||||
public float Rotation { get; }
|
||||
|
||||
public IEnumerable<CarLocationResponse> Cars { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user