public void AreNotColliding() { PlayerDot playerDot = new PlayerDot(200); CircleArc circleArc = new CircleArc(Math.PI / 2, Math.PI * 3.2); Assert.IsFalse(CollisionDetector.AreColliding(playerDot, circleArc)); }
public void StartingPos200Radius() { PlayerDot playerDot = new PlayerDot(200); Point expectedPosition = new Point(200, 0); Assert.AreEqual(expectedPosition, playerDot.GetPosition()); }
/// Retracts the segment towards the new player dot and removes the old one void RemoveDot(bool removeDot0) { //StartCoroutine(RadiusFade(true)); bool switchSegmentDirection = false; if (removeDot0 && dot0 != null) { dot0.Remove(); dot0 = null; if (dot1 != null) { if (newestDot == DotType.Dot1) { switchSegmentDirection = true; } newestDot = DotType.Dot1; FadeRadius(true); } else { FadeRadius(false); } } else if (!removeDot0 && dot1 != null) { dot1.Remove(); dot1 = null; if (dot0 != null) { if (newestDot == DotType.Dot0) { switchSegmentDirection = true; } newestDot = DotType.Dot0; FadeRadius(true); } else { FadeRadius(false); } } // both dots are gone => Death/Restart if (dot1 == null && dot0 == null) { Game.SetState(Game.State.Death); radius = 0; radiusOpacity = 0; newestDot = DotType.None; } // empty the segment in between those two dots playerSegment.EmptySegment(switchSegmentDirection); }
public void AreCollidingAtNear2Pi() { PlayerDot playerDot = new PlayerDot(200); playerDot.MoveCounterClockwise(Math.PI * 2.1); CircleArc circleArc = new CircleArc(0.5, Math.PI * 1.9); Assert.IsFalse(CollisionDetector.AreColliding(playerDot, circleArc)); }
public void AreNotCollidingAt0() { PlayerDot playerDot = new PlayerDot(200); playerDot.MoveCounterClockwise(Math.PI / 2); CircleArc circleArc = new CircleArc(Math.PI / 2, 0); Assert.IsFalse(CollisionDetector.AreColliding(playerDot, circleArc)); }
public void MoveCounterClockwisePI() { PlayerDot playerDot = new PlayerDot(200); playerDot.MoveCounterClockwise(Math.PI); Point expectedPosition = new Point(200, 400); Assert.AreEqual(expectedPosition, playerDot.GetPosition()); }
public void MoveCounterClockwiseGetRadian() { PlayerDot playerDot = new PlayerDot(200); double startRadian = playerDot.GetRadian(); playerDot.MoveCounterClockwise(0.6); double expectedRadian = startRadian + 0.6; Assert.AreEqual(expectedRadian, playerDot.GetRadian()); }
public void MoveClockwiseGetRadian() { PlayerDot playerDot = new PlayerDot(200); double startRadian = playerDot.GetRadian(); playerDot.MoveClockwise(1.2); double expectedRadian = startRadian - 1.2; Assert.AreEqual(expectedRadian, playerDot.GetRadian()); }
public void Draw() { Background.Draw(_location); if (_agent.Player.Inventory.HasMap) { MiniMap.Draw(MiniMapLocation + _location); } if (_agent.Player.Inventory.HasCompass) { TriforceDot.Draw(MiniMapLocation + TriforceLocation + _location); } var dungeonManager = (DungeonManager)_agent.DungeonManager; if (dungeonManager.CurrentRoomMapped) { PlayerDot.Draw(MiniMapLocation + LinkLocation + _location); } Primary?.Draw(PrimaryLocation + _location); Secondary?.Draw(SecondaryLocation + _location); int i; for (i = 0; i < _agent.Player.Health / 2; i++) { Heart.Draw(HeartsLocation + _location + HeartOffset * i); } if (_agent.Player.Health % 2 != 0) { HalfHeart.Draw(HeartsLocation + _location + HeartOffset * i); i++; } for (; i < _agent.Player.MaxHealth / 2; i++) { EmptyHeart.Draw(HeartsLocation + _location + HeartOffset * i); } _rupeeCount.Draw(); _bombCount.Draw(); _keyCount.Draw(); }
/// Creates a new PlayerDot Object at the lookDestination position and draws the connecting segment in between void SpawnDot() { AudioManager.instance.Play("Kick"); // only spawn dots of one of the dot slots is free => dont spawn more than the two conencted to the input triggers if (dot0 != null && dot1 != null) { return; } //Debug.Log("Dot0: " + dot0 + " ---- Dot1: " + dot1); int dotWasSpawned = -1; // -1 = no dot spawned, 0 = dot0 spawndd, 1 = dot1 spawned Vector2 activePosition = new Vector2(); Vector2 spawnPosition; Vector2 controllerInput = new Vector2(Input.GetAxis("Joystick X"), Input.GetAxis("Joystick Y")); // dot1 exists, dot0 doesnt => spawn dot0 if (dot1 != null && dot0 == null) { activePosition = dot1.transform.position; spawnPosition = activePosition + lookDirection; dotWasSpawned = 0; FadeRadius(false); } // dot0 exists, dot1 doesnt => spawn dot1 else if (dot0 != null && dot1 == null) { activePosition = dot0.transform.position; spawnPosition = activePosition + lookDirection; dotWasSpawned = 1; FadeRadius(false); } // there are no dots, spawn the first dot else { // get the world mouse position and spawn the dot there Vector2 mousePos = Input.mousePosition; mousePos = Camera.main.ScreenToWorldPoint(mousePos); spawnPosition = mousePos; dotWasSpawned = 0; FadeRadius(true); } // spawn the new dot GameObject newDotGo = GameObject.Instantiate(playerDotPrefab, spawnPosition, Quaternion.identity); PlayerDot newPlayerDot = newDotGo.GetComponent <PlayerDot>(); // set the newest dot information if (dotWasSpawned == 0) { newDotGo.name = "dot0"; dot0 = newPlayerDot; newestDot = DotType.Dot0; } else if (dotWasSpawned == 1) { newDotGo.name = "dot1"; dot1 = newPlayerDot; newestDot = DotType.Dot1; } //Debug.Log("activePosition: " + activePosition + " spawnPosition: " + spawnPosition); // fill the segment in between two dots if (dot0 != null && dot1 != null) { if (newestDot == DotType.Dot0) { playerSegment.FillSegment(dot1.transform.position, dot0.transform.position); } else if (newestDot == DotType.Dot1) { playerSegment.FillSegment(dot0.transform.position, dot1.transform.position); } } }