public bool CanWalkTo(DungeonVector2 position) { if (!Dungeon.CheckValidPosition(position.x, position.y)) { return(false); } if (!Dungeon.GetTile(position.x, position.y).walkable) { return(false); } return(true); }
public bool Walk(DungeonVector2 delta, bool rotate = true) { if (!CanWalk(delta)) { return(false); } if (rotate) { Rotate(delta.GetRotation()); } MoveTo(Position + delta); return(true); }
public void Init(DungeonUnity dungeonUnity, DungeonVector2 position, DungeonTile tile) { this.tile = tile; this.position = position; this.dungeonUnity = dungeonUnity; trans.position = dungeonUnity.GetWorldPosition(position); trans.rotation = Quaternion.identity; floor = AddSide(tile.floor, DungeonTileSideType.Floor); ceiling = AddSide(tile.ceiling, DungeonTileSideType.Ceiling); wallNorth = AddSide(tile.wallNorth, DungeonTileSideType.WallNorth); wallSouth = AddSide(tile.wallSouth, DungeonTileSideType.WallSouth); wallEast = AddSide(tile.wallEast, DungeonTileSideType.WallEast); wallWest = AddSide(tile.wallWest, DungeonTileSideType.WallWest); }
static public bool IsSideNonSolid(DungeonMap dungeon, DungeonVector2 position, DungeonTileSideType sideType) { switch (sideType) { case DungeonTileSideType.WallSouth: if (position.y > 0 && dungeon.GetTile(position.x, position.y - 1).solid) { return(false); } break; case DungeonTileSideType.WallNorth: if (position.y + 1 < dungeon.SizeY && dungeon.GetTile(position.x, position.y + 1).solid) { return(false); } break; case DungeonTileSideType.WallWest: if (position.x > 0 && dungeon.GetTile(position.x - 1, position.y).solid) { return(false); } break; case DungeonTileSideType.WallEast: if (position.x + 1 < dungeon.SizeX && dungeon.GetTile(position.x + 1, position.y).solid) { return(false); } break; } return(true); }
public void SetStartingPosition(DungeonVector2 position) { startingPosition = position; }
public bool CanWalk(DungeonVector2 delta) { return(CanWalkTo(Position + delta)); }
public DungeonEventEntityMoved(DungeonEntity entity, DungeonVector2 from, DungeonVector2 to) : base(DungeonEventType.EntityMoved) { this.entity = entity; this.from = from; this.to = to; }
static public DungeonEvent CreateEntityMoved(DungeonEntity entity, DungeonVector2 from, DungeonVector2 to) { return(new DungeonEventEntityMoved(entity, from, to)); }
public Vector3 GetWorldPosition(DungeonVector2 position) { return(new Vector3(position.x, 0, position.y)); }