// 현재위치로부터 목적지까지의 방향과 회전각 계산 void calculateDirection() { // 목적지를 향한 방향벡터 direction = destinationPos - myPos; direction.Normalize(); // 목적지를 향한 방향벡터를 회전각으로 변환 destinationAngle = Vector3.Angle(Vector3.forward, direction); destinationAngle = Vector3.Dot(Vector3.right, direction) > 0.0 ? destinationAngle : -destinationAngle; // 안내 캐릭터의 회전각 characterAxis.transform.rotation = Quaternion.Euler(0f, destinationAngle, 0f); // 목적지까지의 남은 거리를 m 단위로 계산 distance = (float)(DistanceManager.Distance(mlatitude, mlongitude, dlatitude, dlongitude, 'K') * 1000); // 20000m (20km) 보다 더 멀리 있으면 if (distance >= 20000) { distanceText.text = "걸어가기엔 너무 멀어요!"; } else if (distance <= 10) { // 도착 distanceText.text = "근처에 도착하였습니다!"; } else { distanceText.text = "남은 거리 : " + Mathf.Floor(distance) + " m"; } }
public DistanceManagerFixture() { DistanceManager = new DistanceManager("d") { Cities = FixtureHelpers.RawCities.ToList() }; }
public void TestManhattenDistance() { IDistance manDistance = new ManhattenDistance(); var distanceManager = new DistanceManager(manDistance); var distance = distanceManager.calculateDistance(new Origin(0, 0), new Origin(1, 1)); Assert.True(distance == 2); }
public void AddPath_WithRightFormatOfPattern_ShouldAddInLocations(string route) { // Arrange _distanceEngine = new DistanceManager(_locations.Object); // Act _distanceEngine.AddPath(route); // Assert _locations.Verify(dic => dic.Add(It.IsAny<KeyValuePair<string, Location>>()), Times.Once); }
public void AddPath_WhenExistSameLocation_ShouldNotAddInLocations(string route) { // Arrange _distanceEngine = new DistanceManager(_locations.Object); const string locationName = "A"; _locations.Setup(dic => dic.ContainsKey(locationName)).Returns(true); // Act _distanceEngine.AddPath(locationName); // Assert _locations.Verify(dic => dic.Add(It.IsAny<KeyValuePair<string, Location>>()), Times.Never()); }
public IEnumerator ConTowerPos() { yield return(new WaitForSeconds(1)); float slatitude = googleMap.centerLocation.latitude; //자신의 위치를 구글맵으로 불러오는 공식 위도 float slongitude = googleMap.centerLocation.longitude; //자신의 위치를 구글맵으로 불러오는 공식 경도 double distance = DistanceManager.Distance(slatitude, slongitude, latitude, longitude, 'K') * 1000; if (distance < 1) { } if (distance > 1) { } }
public void Init() { _distanceEngine = new DistanceManager(new Dictionary<string, Location>()); // Test Input: AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7 _distanceEngine.AddPath("AB5"); _distanceEngine.AddPath("BC4"); _distanceEngine.AddPath("CD8"); _distanceEngine.AddPath("DC8"); _distanceEngine.AddPath("DE6"); _distanceEngine.AddPath("AD5"); _distanceEngine.AddPath("CE2"); _distanceEngine.AddPath("EB3"); _distanceEngine.AddPath("AE7"); }
void Update() { float slatitude = map.centerLocation.latitude; float slongitude = map.centerLocation.longitude; float distance = (float)DistanceManager.Distance( latiTude, longiTude, slatitude, slongitude, 'K') * 1000; if (distance < 20) { diaryManager.diary_Second(); } else { } }
//((distance traveled * 3) * (multiplier)) + (Coins* 4) private void Awake() { distanceManager = GetComponent <DistanceManager>(); comboManager = GetComponent <ComboManager>(); coinManager = GetComponent <CoinManager>(); }
private void Awake() { DistanceManagerVariable = this; }
public void GetShortestLength_WhenRouteFromAtoC_ShouldReturnNine() { // Arrange _distanceEngine = new DistanceManager(GenerateSampleLocations()); const string routeFrom = "A"; const string routeTo = "C"; const string expected = "9"; // Act var result = _distanceEngine.GetShortestLength(routeFrom, routeTo); // Assert Assert.That(result, Is.EqualTo(expected)); }
public void GetPathNumber_WhenRouteFromCtoC_ShouldReturnTwo() { // Arrange _distanceEngine = new DistanceManager(GenerateSampleLocations()); const string routeFrom = "C"; const string routeTo = "C"; const string expected = "2"; // Act var result = _distanceEngine.GetPathNumber(routeFrom, routeTo); // Assert Assert.That(result, Is.EqualTo(expected)); }
public void GetDistance_WhenRouteAED_ShouldReturnNotSuchARoute() { // Arrange _distanceEngine = new DistanceManager(GenerateSampleLocations()); var route = new List<string> { "A", "E", "D" }; const string expected = "NOT SUCH ROUTE"; // Act var result = _distanceEngine.GetDistance(route); // Assert Assert.That(result, Is.EqualTo(expected)); }
public void GetDistance_WhenRouteABC_ShouldReturnNine() { // Arrange _distanceEngine = new DistanceManager(GenerateSampleLocations()); var route = new List<string> {"A", "B", "C"}; const string expected = "9"; // Act var result = _distanceEngine.GetDistance(route); // Assert Assert.That(result, Is.EqualTo(expected)); }
// Use this for initialization void Start() { timeManager = GameObject.Find("TimeManager").gameObject.GetComponent <TimeManager>(); distanceManager = GameObject.Find("DistanceManager").gameObject.GetComponent <DistanceManager>(); spawnManager = GameObject.Find("SpawnManager").gameObject.GetComponent <AirEnemyManager>(); }
// Start is called before the first frame update void Start() { Instance = this; }