private bool CanPerformStep() { Point loc = movingSprite.position.ToPoint(); Point finish = new Point(); try { finish = (movePath[currentNodeIndex + 1].coord.ToVector2() * 64).ToPoint(); } catch { finish = (movePath[currentNodeIndex].coord.ToVector2() * 64).ToPoint(); } int nextDirection = directionNextNode(); bool bMoveOn = false; switch (nextDirection) { case 0: if (loc.Y <= finish.Y) { bMoveOn = true; } break; case 1: if (loc.Y >= finish.Y) { bMoveOn = true; } break; case 2: if (loc.X >= finish.X) { bMoveOn = true; } break; case 3: if (loc.X <= finish.X) { bMoveOn = true; } break; } // if (loc != finish) if (!bMoveOn) { if (bShouldIgnoreCollisionPlayer) { movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Movement; return(true); } if (PlayerController.selectedSprite != null) { if (movingSprite.Contains(PlayerController.selectedSprite.trueMapSize())) { movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; bStartIgnorer = true; return(false); } } //foreach (var hBox in movingSprite.closeProximityHitboxes()) //{ // Rectangle temp = hBox; // if (temp.Intersects(PlayerController.selectedSprite.spriteGameSize) || temp.Contains(PlayerController.selectedSprite.spriteGameSize)) // { // movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; // bStartIgnorer = true; // return false; // } //} movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Movement; bStartIgnorer = false; return(true); } else { if (currentNodeIndex == movePath.Count - 2 || movePath.Count == 1) { //End reached return(StopPathMovement()); } else { currentNodeIndex++; if (bShouldIgnoreCollisionPlayer) { movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Movement; return(true); } if (PlayerController.selectedSprite != null) { if (movingSprite.Contains(PlayerController.selectedSprite.trueMapSize())) { movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; bStartIgnorer = true; return(false); } } //foreach (var hBox in movingSprite.closeProximityHitboxes()) //{ // Rectangle temp = hBox; // if (temp.Intersects(PlayerController.selectedSprite.spriteGameSize) || temp.Contains(PlayerController.selectedSprite.spriteGameSize)) // { // movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; // bStartIgnorer = true; // return false; // } //} movingSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Movement; bStartIgnorer = false; return(true); } } }