private Link AddToQueue( Tile currTile, Link parentLink, Queue <Link> queue, Dictionary <Tile, bool> tileHasBeenSearched, Utilities.Direction direction ) { if (!IsValidTile(currTile, tileHasBeenSearched, direction)) { return(null); } Link currLink = new Link(currTile, parentLink, direction); if (currLink == null) { return(null); } queue.Enqueue(currLink); SearchTile(tileHasBeenSearched, currTile); return(currLink); }
public void Attack(Utilities.Direction direction) { walkStepCount = 0; switch (direction) { case (Utilities.Direction.Left): sR.sprite = attack.left[attackStepCount]; break; case (Utilities.Direction.Right): sR.sprite = attack.right[attackStepCount]; break; case (Utilities.Direction.Up): sR.sprite = attack.up[attackStepCount]; break; case (Utilities.Direction.Down): sR.sprite = attack.down[attackStepCount]; break; default: sR.sprite = idle[0]; break; } attackStepCount = (attackStepCount + 1) % attackStep; }
public void Walk(Utilities.Direction direction) { attackStepCount = 0; switch (direction) { case (Utilities.Direction.Left): sR.sprite = walk.left[walkStepCount]; break; case (Utilities.Direction.Right): sR.sprite = walk.right[walkStepCount]; break; case (Utilities.Direction.Up): sR.sprite = walk.up[walkStepCount]; break; case (Utilities.Direction.Down): sR.sprite = walk.down[walkStepCount]; break; default: sR.sprite = idle[0]; break; } walkStepCount = (walkStepCount + 1) % walkStep; }
public Door(int x, int y, Utilities.Direction direction, Container container, int radius) { this.x = x; this.y = y; this.direction = direction; this.container = container; this.radius = radius; }
private Link AddToQueue( Link parentLink, Utilities.Direction direction, Queue <Link> queue, Dictionary <Tile, bool> tileHasBeenSearched ) { if (parentLink == null) { return(null); } int currX = parentLink.currTile.x; int currY = parentLink.currTile.y; int newX = 0; int newY = 0; switch (direction) { case Utilities.Direction.NORTH: newX = currX; newY = currY - 1; break; case Utilities.Direction.SOUTH: newX = currX; newY = currY + 1; break; case Utilities.Direction.WEST: newX = currX - 1; newY = currY; break; case Utilities.Direction.EAST: newX = currX + 1; newY = currY; break; } Tile currTile = map.GetTile(newX, newY); return(AddToQueue(currTile, parentLink, queue, tileHasBeenSearched, direction)); }
public Tile GetNeighbor(Utilities.Direction direction) { switch (direction) { case Utilities.Direction.NORTH: return(map.GetTile(x, y - 1)); case Utilities.Direction.SOUTH: return(map.GetTile(x, y + 1)); case Utilities.Direction.WEST: return(map.GetTile(x - 1, y)); case Utilities.Direction.EAST: return(map.GetTile(x + 1, y)); } return(null); }
public void OpenDoorArea(Door door, TileType tileType) { CreateTileAndSetTile(door.x, door.y, door.container, tileType); Pair <int, int> currLeftOfPair = new Pair <int, int>(door.x, door.y); Pair <int, int> currRightOfPair = new Pair <int, int>(door.x, door.y); Utilities.Direction leftOf = Utilities.LeftOf(door.direction); Utilities.Direction rightOf = Utilities.RightOf(door.direction); for (int i = 0; i < door.radius; i++) { currLeftOfPair = Utilities.CordInDirection(leftOf, currLeftOfPair); currRightOfPair = Utilities.CordInDirection(rightOf, currRightOfPair); CreateTileAndSetTile(currLeftOfPair, door.container, tileType); CreateTileAndSetTile(currRightOfPair, door.container, tileType); } }
private bool IsValidTile(Tile potentialTile, Dictionary <Tile, bool> tileHasBeenSearched, Utilities.Direction direction) { if ( potentialTile == null || potentialTile.tileType != earthTileType || TileHasBeenSearched(tileHasBeenSearched, potentialTile) ) { return(false); } Pair <int, int> currLeftOfPair = new Pair <int, int>(potentialTile.x, potentialTile.y); Pair <int, int> currRightOfPair = new Pair <int, int>(potentialTile.x, potentialTile.y); Utilities.Direction leftOf = Utilities.LeftOf(direction); Utilities.Direction rightOf = Utilities.RightOf(direction); for (int i = 0; i < spaceBetweenRooms / 2; i++) { currLeftOfPair = Utilities.CordInDirection(leftOf, currLeftOfPair); currRightOfPair = Utilities.CordInDirection(rightOf, currRightOfPair); if ( !IsValidSurroundingTile(currLeftOfPair) || !IsValidSurroundingTile(currRightOfPair) ) { return(false); } } Pair <int, int> forwardPair = Utilities.CordInDirection(direction, potentialTile.x, potentialTile.y); if (!IsValidSurroundingTile(forwardPair)) { return(false); } return(true); }
public void FillLine(int x, int y, int length, Utilities.Direction direction, TileType tileType, Container container) { switch (direction) { case Utilities.Direction.NORTH: FillArea(x, y - length, 1, length, tileType, container); break; case Utilities.Direction.SOUTH: FillArea(x, y, 1, length, tileType, container); break; case Utilities.Direction.WEST: FillArea(x - length, y, length, 1, tileType, container); break; case Utilities.Direction.EAST: FillArea(x, y, length, 1, tileType, container); break; } }
public static Direction Hexagonal(this Utilities.Direction direction) { return((Direction)((int)Math.Floor(direction.Degrees * 1 / 60f + 0.5f) % 6 + 1)); }
//Appliquer une force directionnelle horizontale public void ApplyForce(Utilities.Direction dir) { this._acceleration = new Vector2(((dir == 0 ? -1 : 1) * this._vitesseMaxX) - this._speed.X / this._alphaX, this._acceleration.Y); }
public void Idle(Utilities.Direction direction) { sR.sprite = idle[(int)direction]; }
public void Walk(Utilities.Direction direction) { sR.sprite = walk[(int)direction]; }
public Link(Tile currTile, Link parentLink, Utilities.Direction currTileDirection = Utilities.Direction.EAST) { this.currTile = currTile; this.parentLink = parentLink; this.currTileDirection = currTileDirection; }