public MapCell(Tile tile, int rowIndex, int columnIndex) { this.tiles = new Tiles(); this.RowIndex = rowIndex; this.ColumnIndex = columnIndex; this.tiles.Add(tile); }
public static TileProperty getFrom(Tiles type) { TileProperty ret = new TileProperty(); switch (type) { case Tiles.Main: ret.Size = 10; ret.Tag = "m"; break; case Tiles.MainDeco: ret.Size = 10; ret.Tag = "md"; break; case Tiles.Button: ret.Size = 6; ret.Tag = "button"; break; case Tiles.Slot: ret.Size = 22; ret.Tag = "slot"; break; case Tiles.Cursor: ret.Size = 2; ret.Tag = "cursor"; break; case Tiles.Menu: ret.Size = 1; ret.Tag = "menu"; break; } return ret; }
public void AddPropertiesByArray(Tiles.Property[] prop) { foreach (Tiles.Property p in prop) { AddProperty(p); }//foreach }
public void CreateTiledMap(int numTilesX, int numTilesY, int tileSizeX, int tileSizeY, int[,] mapArray, Tiles tiles) { this.tileSizeX = tileSizeX; this.tileSizeY = tileSizeY; CreateTiledMap (numTilesX, numTilesY, mapArray, tiles); }
public void CreateTiledMap(int numTilesX, int numTilesY, int[,] mapArray, Tiles tiles, bool[,] ownObjs) { this.numTilesX = numTilesX; this.numTilesY = numTilesY; CreateTiledMap (mapArray, tiles, ownObjs); }
public Category (Tiles.TileGroupInfo info, int columns) { WidgetFlags |= WidgetFlags.NoWindow; header = new Gtk.HBox (false, 0); headerExpander = new Gtk.Expander ("<big><b>" + GLib.Markup.EscapeText (info.Name) + "</b></big>"); ((Gtk.Label) headerExpander.LabelWidget).SetAlignment (0.0f, 0.5f); headerExpander.UseMarkup = true; headerExpander.UseUnderline = true; headerExpander.Show (); header.PackStart (headerExpander, true, true, 0); headerExpander.Activated += OnActivated; scope = Tiles.Utils.TileGroupToScopeType(info.Group); position = new Gtk.Label (); position.ModifyFg (Gtk.StateType.Normal, position.Style.Base (Gtk.StateType.Selected)); header.PackStart (position, false, false, 0); position.Show (); prev = MakeButton (header, Gtk.Stock.GoBack, OnPrev); next = MakeButton (header, Gtk.Stock.GoForward, OnNext); header.Show (); header.Parent = this; header.SizeRequested += HeaderSizeRequested; tiles = new SortedTileList (Beagle.Search.SortType.Relevance); Columns = columns; UpdateButtons (); Expanded = true; }
/** * Runs at load time */ void Start () { gameController = GameController.S; mapsController = MapsController.S; resourceTileController = ResourceTileController.S; unitsController = UnitsController.S; tilesCollection = Tiles.S; }
public void BuildLevel(Tiles[,] level) { createdBase = false; for (int i = 0; i < level.GetLength(0); i++) { for(int j = 0; j < level.GetLength(1);j++){ Component block = new Component(); switch (level[i, j]) { case Tiles.Empty: continue; case Tiles.Wall: block = wall; break; case Tiles.HardWall: block = hardWall; break; case Tiles.GameBase: block = gameBase; break; case Tiles.Water: block = water; break; case Tiles.Forest: block = forest; break; } int yCoordinate = level.GetLength(0) - i-1; Component currBlock = Instantiate( block, new Vector3(j * 0.32f, yCoordinate * 0.32f, 0), new Quaternion()) as Component; if (level[i, j] == Tiles.GameBase) { if (!createdBase) { currBlock.GetComponent<BaseHealth>().side = 1; createdBase = true; } else { currBlock.GetComponent<BaseHealth>().side = 2; } NetworkServer.Spawn(currBlock.gameObject); } else if (level[i, j] == Tiles.Wall) { currBlock.GetComponent<Wall>().Spawn(); } else { NetworkServer.Spawn(currBlock.gameObject); } objects.Add(currBlock); } } }
protected BasePlayer(Tiles t) { Open = false; _hand = new Hand(); while (_hand.Count < InitialDraw) { Draw(t); } Global.Logger.Debug(string.Format("{0, 7} drew {1}", Name(), _hand)); }
public virtual void PayRent(Player player, Tiles.Contracts.PropertyTile property) { ObjectValidator.NullObjectValidation(player, "Player instance cannot be null"); ObjectValidator.NullObjectValidation(property, "PropertyTile instance cannot be null"); if (property.Owner == null) { player.WidthdrawMoney(property.BaseRent); } }
public void DropBomb(Tiles spawnPoint) { if (spawnPoint != null && !spawnPoint.occupied) { Vector3 spawnPosition = new Vector3(spawnPoint.transform.position.x, 1, spawnPoint.transform.position.z); GameObject Bom = (GameObject)Instantiate(Resources.Load("Bom"), spawnPosition, transform.rotation); spawnPoint.occupied = Bom; Bom.GetComponent<Bomb>().firePower = firePower; } }
public void generateTower(Tiles.EmptyTile emptyTile, Combinator.TowerType tower) { switch(tower) { case Combinator.TowerType.FIREBALL: towers.Add(Tower.getTower<FireTower>(Game, 40.0f, tileMap.EmptyTileList[emptyTile.index].position, 0.75f)); break; case Combinator.TowerType.THUNDERSTORM: towers.Add(Tower.getTower<LightningTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 0.14f)); break; case Combinator.TowerType.EARTHQUAKE: towers.Add(Tower.getTower<EarthTower>(Game, 0.0f, tileMap.EmptyTileList[emptyTile.index].position, 999999.0f)); break; case Combinator.TowerType.CORROSIVE: towers.Add(Tower.getTower<PoisonTower>(Game, 2.0f, tileMap.EmptyTileList[emptyTile.index].position, 1.0f)); break; case Combinator.TowerType.TORNADO: towers.Add(Tower.getTower<TornadoTower>(Game, 0.0f, tileMap.EmptyTileList[emptyTile.index].position, 999999.0f)); break; case Combinator.TowerType.GLACIER: towers.Add(Tower.getTower<WaterTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.DARKFLAMES: towers.Add(Tower.getTower<ShadowTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.SOLAR: towers.Add(Tower.getTower<PlasmaTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.BLINDING: towers.Add(Tower.getTower<LightTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.BLACKHOLE: towers.Add(Tower.getTower<BlackHoleTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.INFINITY: towers.Add(Tower.getTower<InfinityTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; case Combinator.TowerType.MAGMATIC: towers.Add(Tower.getTower<MagmaTower>(Game, 10.0f, tileMap.EmptyTileList[emptyTile.index].position, 2.0f)); break; } }
/// <summary> /// Initializes a new instance of <see cref="Workspace"/> for a given <see cref="Token"/> with a given <see cref="ICommunication"/> /// </summary> /// <param name="token"><see cref="Token">Access token to use</see></param> /// <param name="communication"><see cref="ICommunication"/> to use</param> public Workspace(Token token, ICommunication communication) { _communication = communication; Groups = new Groups(token, communication); Datasets = new Datasets(token, communication); Tables = new Tables(token, communication); Rows = new Rows(token, communication); Dashboards = new Dashboards(token, communication); Reports = new Reports(token, communication); Tiles = new Tiles(token, communication); }
public void CreateTiledMap(int[,] mapArray, Tiles tiles) { for (int y = 0; y < numTilesY; y++) { for (int x = 0; x < numTilesX; x++) { if (mapArray[x,y] != 0 || addBlankTiles) { CreateSquare(x, y, tiles.GetTileUV(mapArray[x,y])); } } } BuildMesh (); }
public override async Task<bool> Play(GameGraph game, Tiles tiles) { await Task.Delay(300); if (!LookFormatch(game)) { Draw(tiles); if (!LookFormatch(game)&& !Open) { Global.Logger.Comment(string.Format("{0}'s line opened", Name())); Open = true; } } return !_hand.Any(); }
//Almost identical to robot player except for where the await happens public override async Task<bool> Play(GameGraph game, Tiles tiles) { if (! await AttemptToPlay(game) && !_kill) { Draw(tiles); Game.Instance().Paint(); await Task.Delay(300); if (! await AttemptToPlay(game) && !Open) { Open = true; } } return !_hand.Any(); }
// Functions public Texture2D GetGroupTexture(Tiles tile,int subindex) { if (tile == Tiles.NULL_BLANK) { return blank; } foreach(var t in tiles) { if (t.tile == tile) { return t.textures[subindex]; } } return null; }
public void clickedTile(ref Tiles tile) { if (tile.state == tileStates.empty) { int i = m_parent.getPlayerTurn(); if (i == 1) { tile.state = tileStates.x; m_parent.nextPlayerTurn(); gameCheck(); } else if (i == 2) { tile.state = tileStates.o; m_parent.nextPlayerTurn(); gameCheck(); } } else { }; }
public Brush brushTile(Tiles a) { ImageBrush brush = null; if (a is WaterImpl) { brush = water; }else if (a is PlainImpl) { brush = plain; }else if (a is MountainImpl) { brush = mountain; }else if (a is ForestImpl) { brush = forest; } return brush; }
SpaceWrapper CreateSpaceWrapper(int x, int y, Tiles value) { var instance = Object.Instantiate(prefab, transform.position+new Vector3(x*size+size,0f,y*size+size), Quaternion.identity) as GameObject; instance.transform.parent = this.transform; // TODO: This is where we create the default space instance.GetComponent<SpaceWrapper>().Value = value; var tile = Object.Instantiate(prefabs[(int)value], transform.position+new Vector3(x*size+size,0f,y*size+size), Quaternion.identity) as GameObject; tile.transform.parent = instance.transform; tile.transform.localPosition = Vector3.zero; instance.GetComponent<SpaceWrapper>().CurrentTile = tile; instance.GetComponent<SpaceWrapper>().board = this; // for (var i=0; i<Random.Range(0,3); ++i) // instance.GetComponent<SpaceWrapper>().RotateTile(); return instance.GetComponent<SpaceWrapper>(); }
/// <summary> /// Saves the file to the specified stream. /// </summary> /// <param name="stream">The stream to save to.</param> public override void Save(Stream stream) { BinaryWriter writer = new BinaryWriter(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR")); writer.Write(BLOCK_COUNT); long[] offsets = new long[BLOCK_COUNT]; for (int i = 0; i < BLOCK_COUNT; i++) { writer.Write(i); writer.Write(0); } offsets[0] = stream.Position; writer.Write((int)Type); writer.Write(Width); writer.Write(Height); writer.Write(GridCount); writer.Write(GridSize); writer.Write(StartPosition.X); writer.Write(StartPosition.Y); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { writer.Write(Positions[x, y].IsUsed); writer.Write(Positions[x, y].Position); } } offsets[1] = stream.Position; writer.Write(SpawnPoints.Count); SpawnPoints.ForEach(spawnPoint => { writer.Write(spawnPoint.Position); writer.WriteByteString(spawnPoint.Name); }); offsets[2] = stream.Position; writer.Write(Textures.Count); Textures.ForEach(texture => { writer.WriteByteString(texture); }); offsets[3] = stream.Position; writer.Write(Tiles.Count); Tiles.ForEach(tile => { writer.Write(tile.Layer1); writer.Write(tile.Layer2); writer.Write(tile.Offset1); writer.Write(tile.Offset2); writer.Write(tile.BlendingEnabled ? 1 : 0); writer.Write((int)tile.Rotation); writer.Write(tile.TileType); }); offsets[4] = stream.Position; writer.WriteByteString(Name); writer.Write(IsUnderground ? 1 : 0); writer.WriteByteString(BackgroundMusicFilePath); writer.WriteByteString(SkyFilePath); writer.Write(EconomyCheckRate); writer.Write(PopulationBase); writer.Write(PopulationGrowthRate); writer.Write(MetalConsumption); writer.Write(StoneConsumption); writer.Write(WoodConsumption); writer.Write(LeatherConsumption); writer.Write(ClothConsumption); writer.Write(AlchemyConsumption); writer.Write(ChemicalConsumption); writer.Write(IndustrialConsumption); writer.Write(MedicineConsumption); writer.Write(FoodConsumption); for (int i = 0; i < BLOCK_COUNT; i++) { stream.Seek(sizeof(int) + i * sizeof(int) * 2 + sizeof(int), SeekOrigin.Begin); writer.Write((int)offsets[i]); } }
/// <summary> /// Ermittelt, ob die angegebene Zelle außerhalb des Rands liegt oder Shape None hat. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> private bool IsNothing(int x, int y) { return( x < 0 || x >= Tiles.GetLength(0) || y < 0 || y >= Tiles.GetLength(1)); }
public void FindSelectableTiles() { ComputeAdjacencyList(null);//added null GetCurrentTile(); //this is the bfs algorithm Queue <Tiles> process = new Queue <Tiles>(); process.Enqueue(currentTile); currentTile.visited = true; //currentTile.parent = ?? leave as null while (process.Count > 0) { Tiles t = process.Dequeue(); Vector2 position = t.transform.position; LayerMask mask = LayerMask.GetMask("character"); LayerMask obstactleMask = LayerMask.GetMask("obstactle"); RaycastHit2D hit = Physics2D.Raycast(position, Vector2.zero, .2f, mask); RaycastHit2D obstactleHit = Physics2D.Raycast(position, Vector2.zero, .2f, obstactleMask); if (state == State.Move) { if (!t.current && !hit.collider && !obstactleHit.collider) { selectableTile.Add(t); t.selectable = true; } if (t.distance < move) { foreach (Tiles tile in t.adjacencyList) { RaycastHit2D hit2 = Physics2D.Raycast(tile.transform.position, Vector2.zero, .2f, obstactleMask); if (!tile.visited && !hit2.collider) { tile.parent = t; tile.visited = true; tile.distance = 1 + t.distance; process.Enqueue(tile); } } } } if (state == State.Attack) { if (!t.current && !obstactleHit.collider) { selectableTile.Add(t); t.selectable = true; t.attackMode = true; } if (t.distance < attackRange) { foreach (Tiles tile in t.adjacencyList) { RaycastHit2D hit2 = Physics2D.Raycast(tile.transform.position, Vector2.zero, .2f, obstactleMask); if (!tile.visited && !hit2.collider) { tile.parent = t; tile.visited = true; tile.distance = 1 + t.distance; process.Enqueue(tile); } } } } } }
internal void OnSerializing(StreamingContext context) { // rewrite the Tiles list when time to serialize TileList = Tiles.ToList(); }
public GameManager() { Command = new Command(); generateAreas(); Hero = new Hero("Hero", 5, Tiles[Utils.Random.Next(Tiles.GetLength(0)), Utils.Random.Next(Tiles.GetLength(1))], this); Hero.Logger.WriteLine(Hero.CurrTile); }
public override void Paint(Level level, RoomDef room, Rect inside, bool gold) { FloorRegistry.Paint(level, room, -1, gold); var m = Rnd.Int(2, 4); var a = gold && Rnd.Chance(); Painter.Fill(level, room, m, a ? Tile.FloorD : Tiles.RandomFloor()); Painter.Fill(level, room, m + 1, !a && gold && Rnd.Chance() ? Tile.FloorD : Tiles.RandomNewFloor()); Painter.Fill(level, room, m + 1, LevelSave.BiomeGenerated is DesertBiome ? Tiles.RandomNewFloor() : Tile.Water); }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { TilingPattern.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcVector)); Tiles.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcStyledItem)); TilingScale = ParserSTEP.StripDouble(str, ref pos, len); }
public static IReadOnlyCollection <Directions> WalkableDirections(this Tiles tile) => walkableDirections.ContainsKey(tile) ? walkableDirections[tile] : new Directions[0];
public static bool Walkable(this Tiles tile) => walkableTerrain.Contains(tile);
public static string TileAsset(this Tiles tile) => TileAssets[tile];
void Awake() { Instance = this; }
/// <summary> /// Prüft die angegebe Zelle. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="message"></param> /// <returns></returns> public bool CheckCell(int x, int y, out string message) { if (x < 0 || x >= Tiles.GetLength(0)) { throw new ArgumentOutOfRangeException("X is out of range"); } if (y < 0 || y >= Tiles.GetLength(1)) { throw new ArgumentOutOfRangeException("Y is out of range"); } switch (Tiles[x, y].Shape) { case TileShape.Flat: return(CheckFlatCell(x, y, out message)); case TileShape.CanyonTop: return(CheckCanyonTopCell(x, y, out message)); case TileShape.CanyonBottom: return(CheckCanyonBottomCell(x, y, out message)); case TileShape.CanyonLeft: return(CheckCanyonLeftCell(x, y, out message)); case TileShape.CanyonRight: return(CheckCanyonRightCell(x, y, out message)); case TileShape.CanyonUpperLeftConvex: return(CheckCanyonUpperLeftConvexCell(x, y, out message)); case TileShape.CanyonUpperRightConvex: return(CheckCanyonUpperRightConvexCell(x, y, out message)); case TileShape.CanyonLowerLeftConvex: return(CheckCanyonLowerLeftConvexCell(x, y, out message)); case TileShape.CanyonLowerRightConvex: return(CheckCanyonLowerRightConvexCell(x, y, out message)); case TileShape.CanyonUpperLeftConcave: return(CheckCanyonUpperLeftConcaveCell(x, y, out message)); case TileShape.CanyonUpperRightConcave: return(CheckCanyonUpperRightConcaveCell(x, y, out message)); case TileShape.CanyonLowerLeftConcave: return(CheckCanyonLowerLeftConcaveCell(x, y, out message)); case TileShape.CanyonLowerRightConcave: return(CheckCanyonLowerRightConcaveCell(x, y, out message)); case TileShape.RampTop: return(CheckCanyonTopCell(x, y, out message)); case TileShape.RampLeft: return(CheckCanyonLeftCell(x, y, out message)); case TileShape.RampRight: return(CheckCanyonRightCell(x, y, out message)); case TileShape.RampBottom: return(CheckCanyonBottomCell(x, y, out message)); default: throw new Exception("Unknown CellShape"); } }
/// <summary> /// Führt eine Plausibilitätsprüfung der Karten-Einstellungen durch /// </summary> public void CheckMap() { // Tiles prüfen if (Tiles == null) { throw new InvalidMapException("Tiles Array is null"); } Index2 cells = GetCellCount(); // Karten Dimensionen checken if (cells.X < MIN_WIDTH) { throw new InvalidMapException(string.Format("Map must have at least {0} Columns", MIN_WIDTH)); } if (cells.X > MAX_WIDTH) { throw new InvalidMapException(string.Format("Map must have a maximum of {0} Columns", MAX_WIDTH)); } if (cells.Y < MIN_HEIGHT) { throw new InvalidMapException(string.Format("Map must have at least {0} Rows", MIN_HEIGHT)); } if (cells.Y > MAX_HEIGHT) { throw new InvalidMapException(string.Format("Map must have a maximum of {0} Rows", MAX_HEIGHT)); } // Startpunkte überprüfen if (StartPoints == null) { throw new InvalidMapException("The List of StartPoints is null"); } // Spieleranzahl prüfen if (GetPlayerCount() < MIN_STARTPOINTS) { throw new InvalidMapException(string.Format("There must be at least {0} player", MIN_STARTPOINTS)); } if (GetPlayerCount() > MAX_STARTPOINTS) { throw new InvalidMapException(string.Format("The maximum Player Count is {0}", MAX_STARTPOINTS)); } // Alles Tiles prüfen string message; for (int y = 0; y < Tiles.GetLength(1); y++) { for (int x = 0; x < Tiles.GetLength(0); x++) { if (!CheckCell(x, y, out message)) { throw new InvalidMapException(string.Format("Cell {0}/{1} has the following Error: {2}", x, y, message)); } } } // Alle Startpunkte überprüfen for (int i = 0; i < StartPoints.Length; i++) { // Prüfen, ob die Zelle existiert Index2 startPoint = StartPoints[i]; if (startPoint.X < 0 || startPoint.X >= Tiles.GetLength(0) || startPoint.Y < 0 || startPoint.Y >= Tiles.GetLength(1)) { throw new InvalidMapException(string.Format("StartPoint {0} is out of map bounds", i)); } // Prüfen, ob es sich um eine flache Zelle handelt if (Tiles[startPoint.X, startPoint.Y].Shape != TileShape.Flat) { throw new InvalidMapException(string.Format("StartPoint {0} is not placed on a plane Cell", i)); } // Prüfen, ob noch ein anderer Startpoint auf der selben Zelle ist. for (int j = 0; j < StartPoints.Length; j++) { if (i != j && StartPoints[i] == StartPoints[j]) { throw new InvalidMapException(string.Format("StartPoints {0} and {1} are on the same Cell", i, j)); } } } }
private void UpdateFirstTile() { FirstTile = Tiles.FirstOrDefault(); }
public void GetCurrentTile() { currentTile = GetTargetTile(gameObject); currentTile.current = true; }
public static bool CanWalkToward(this Tiles tile, Directions direction) => tile.WalkableDirections().Contains(direction);
public void SetTile(Vec pos, Tiles type) { stage[pos.x, pos.y] = type; }
public MainWindow() { InitializeComponent(); DataContext = new Tiles(); }
public int GetTileIdByDir(Direction dir, Tiles tiles) { return(tiles.GetTileIdByDir(currentTileId, dir)); }
protected void FindPath(Tiles target) { ComputeAdjacencyList(target); GetCurrentTile(); List <Tiles> openList = new List <Tiles>(); List <Tiles> closedList = new List <Tiles>(); openList.Add(currentTile); //currentTile.parent = ?? currentTile.h = Vector2.Distance(currentTile.transform.position, target.transform.position); currentTile.f = currentTile.h; while (openList.Count > 0) { Tiles t = FindLowestF(openList); closedList.Add(t); if (state == State.Move) { if (t == target) { actualTargetTile = FindEndTile(t); MoveToTile(actualTargetTile); return; } } if (state == State.Attack) { if (t == target) { actualTargetTile = FindAttackEndTile(t); Attack(actualTargetTile); return; } } foreach (Tiles tile in t.adjacencyList) { if (closedList.Contains(tile)) { //Do nothing } else if (openList.Contains(tile)) { float tempG = t.g + Vector2.Distance(tile.transform.position, t.transform.position); if (tempG < tile.g) { tile.parent = t; tile.g = tempG; tile.f = tile.g + tile.h; } } else { tile.parent = t; tile.g = t.g + Vector2.Distance(tile.transform.position, t.transform.position); tile.h = Vector2.Distance(tile.transform.position, target.transform.position); tile.f = tile.g + tile.h; openList.Add(tile); } } } // we will just skip the turn //if(openList.Count == 0) //todo - what happens if there is no path to the target tile }
public void SetPosition(int targetTileId, Tiles tiles, Vector3 pos) { currentTileId = targetTileId; position = tiles.GetTilePos(currentTileId) - pos; }
public void Draw(Tiles t) {}
/// <summary> /// Clears all spawn points, textures and tiles. /// </summary> public void Clear() { SpawnPoints.Clear(); Textures.Clear(); Tiles.Clear(); }
private void LoadTiles() { Map map = Map.TerMur; //West PuzzleTile tile = new PuzzleTile(this, 33, 0); tile.MoveToWorld(new Point3D(971, 2876, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 0); tile.MoveToWorld(new Point3D(971, 2878, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 0); tile.MoveToWorld(new Point3D(972, 2877, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 0); tile.MoveToWorld(new Point3D(973, 2876, 37), map); Tiles.Add(tile); // NorthWest tile = new PuzzleTile(this, 63, 1); tile.MoveToWorld(new Point3D(978, 2868, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 1); tile.MoveToWorld(new Point3D(979, 2868, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 1); tile.MoveToWorld(new Point3D(979, 2869, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 1); tile.MoveToWorld(new Point3D(980, 2870, 37), map); Tiles.Add(tile); // NorthEast tile = new PuzzleTile(this, 33, 2); tile.MoveToWorld(new Point3D(985, 2870, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 2); tile.MoveToWorld(new Point3D(986, 2870, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 2); tile.MoveToWorld(new Point3D(985, 2871, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 2); tile.MoveToWorld(new Point3D(986, 2871, 37), map); Tiles.Add(tile); // East tile = new PuzzleTile(this, 14, 3); tile.MoveToWorld(new Point3D(985, 2876, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 3); tile.MoveToWorld(new Point3D(986, 2877, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 3); tile.MoveToWorld(new Point3D(987, 2878, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 3); tile.MoveToWorld(new Point3D(988, 2879, 37), map); Tiles.Add(tile); // SouthEast tile = new PuzzleTile(this, 1195, 4); tile.MoveToWorld(new Point3D(982, 2881, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 33, 4); tile.MoveToWorld(new Point3D(982, 2882, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 4); tile.MoveToWorld(new Point3D(982, 2883, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 4); tile.MoveToWorld(new Point3D(981, 2883, 37), map); Tiles.Add(tile); // SouthWest tile = new PuzzleTile(this, 33, 5); tile.MoveToWorld(new Point3D(975, 2882, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 14, 5); tile.MoveToWorld(new Point3D(976, 2883, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 63, 5); tile.MoveToWorld(new Point3D(975, 2884, 37), map); Tiles.Add(tile); tile = new PuzzleTile(this, 1195, 5); tile.MoveToWorld(new Point3D(976, 2885, 37), map); Tiles.Add(tile); Teleporter tele = new Teleporter(new Point3D(1050, 2940, 38), map, false); tele.MoveToWorld(new Point3D(1018, 2915, 38), map); Static sparkles = new Static(0x373A); sparkles.MoveToWorld(new Point3D(1018, 2915, 38), map); tele = new Teleporter(new Point3D(1018, 2915, 38), map, false); tele.MoveToWorld(new Point3D(1050, 2940, 38), map); sparkles = new Static(0x373A); sparkles.MoveToWorld(new Point3D(1050, 2940, 38), map); }
public Dumper(Tiles t) : base(t, new BiggestTileStatedgy(), "Denny") { }
public override bool SetXML(XmlElement xml) { Clear(); bool cleanXML = true; //Load the tileset string tilesetName = xml.Attributes["tileset"].InnerText; Tileset = Ogmo.Project.Tilesets.Find(t => t.Name == tilesetName); //Get the export mode TileLayerDefinition.TileExportMode exportMode; if (xml.Attributes["exportMode"] != null) { exportMode = (TileLayerDefinition.TileExportMode)Enum.Parse(typeof(TileLayerDefinition.TileExportMode), xml.Attributes["exportMode"].InnerText); } else { exportMode = Definition.ExportMode; } if (exportMode == TileLayerDefinition.TileExportMode.CSV || exportMode == TileLayerDefinition.TileExportMode.TrimmedCSV) { //CSV Import string s = xml.InnerText; string[] rows = s.Split('\n'); if (rows.Length > tiles.GetLength(1)) { Array.Resize(ref rows, tiles.GetLength(1)); cleanXML = false; } for (int i = 0; i < rows.Length; i++) { string[] tileStrs = rows[i].Split(','); if (tileStrs.Length > TileCellsX) { Array.Resize(ref tileStrs, TileCellsX); cleanXML = false; } if (tileStrs[0] != "") { for (int j = 0; j < tileStrs.Length; j++) { tiles[j, i] = Convert.ToInt32(tileStrs[j]); } } } } else if (exportMode == TileLayerDefinition.TileExportMode.XML || exportMode == TileLayerDefinition.TileExportMode.XMLCoords) { //XML Import foreach (XmlElement tile in xml) { int x = Convert.ToInt32(tile.Attributes["x"].InnerText); int y = Convert.ToInt32(tile.Attributes["y"].InnerText); if (x >= Tiles.GetLength(0) || y >= Tiles.GetLength(1)) { cleanXML = false; continue; } if (tile.Attributes["id"] != null) { int id = Convert.ToInt32(tile.Attributes["id"].InnerText); tiles[x, y] = id; } else if (tile.Attributes["tx"] != null && tile.Attributes["ty"] != null) { int tx = Convert.ToInt32(tile.Attributes["tx"].InnerText); int ty = Convert.ToInt32(tile.Attributes["ty"].InnerText); tiles[x, y] = Tileset.GetIDFromCell(new Point(tx, ty)); } } } ResetBitmaps(); return(cleanXML); }
public async Task<bool> Play(GameGraph game, Tiles tiles) { //this is a really silly way to just say return false; return await Task.Factory.StartNew(() => false); }
public RobotPlayer(Tiles t, IRobotStratedgy strat, string name) : base(t) { _strat = strat; _name = name; }
public HumanPlayer(Tiles t) : base(t) { }
public Moocher(Tiles t) : base(t, null, "Mooch") { _strat = new MoocherStratedgy(Name()); }
public Fool(Tiles t): base (t, new Dumbness(new FirstTileStratedgy(), 10), "Pinky") {}
/// <summary> /// Loads the file from the specified stream. /// </summary> /// <param name="stream">The stream to read from.</param> public override void Load(Stream stream) { BinaryReader reader = new BinaryReader(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR")); int blockCount = reader.ReadInt32(); for (int i = 0; i < blockCount; i++) { ZoneBlock type = (ZoneBlock)reader.ReadInt32(); int offset = reader.ReadInt32(); long nextBlock = stream.Position; stream.Seek(offset, SeekOrigin.Begin); switch (type) { case ZoneBlock.Info: Type = (ZoneType)reader.ReadInt32(); Width = reader.ReadInt32(); Height = reader.ReadInt32(); GridCount = reader.ReadInt32(); GridSize = reader.ReadSingle(); StartPosition = new IntVector2(reader.ReadInt32(), reader.ReadInt32()); for (int w = 0; w < Width; w++) { for (int h = 0; h < Height; h++) { Positions[w, h].IsUsed = reader.ReadBoolean(); Positions[w, h].Position = reader.ReadVector2(); } } break; case ZoneBlock.SpawnPoints: int spawnCount = reader.ReadInt32(); for (int j = 0; j < spawnCount; j++) { SpawnPoint spawnPoint = new SpawnPoint(); spawnPoint.Position = reader.ReadVector3(); spawnPoint.Name = reader.ReadByteString(); SpawnPoints.Add(spawnPoint); } break; case ZoneBlock.Textures: int textureCount = reader.ReadInt32(); for (int j = 0; j < textureCount; j++) { Textures.Add(reader.ReadByteString()); } break; case ZoneBlock.Tiles: int tileCount = reader.ReadInt32(); for (int j = 0; j < tileCount; j++) { ZoneTile tile = new ZoneTile(); tile.Layer1 = reader.ReadInt32(); tile.Layer2 = reader.ReadInt32(); tile.Offset1 = reader.ReadInt32(); tile.Offset2 = reader.ReadInt32(); tile.BlendingEnabled = reader.ReadInt32() != 0; tile.Rotation = (TileRotation)reader.ReadInt32(); tile.TileType = reader.ReadInt32(); Tiles.Add(tile); } break; case ZoneBlock.Economy: Name = reader.ReadByteString(); IsUnderground = reader.ReadInt32() != 0; BackgroundMusicFilePath = reader.ReadByteString(); SkyFilePath = reader.ReadByteString(); EconomyCheckRate = reader.ReadInt32(); PopulationBase = reader.ReadInt32(); PopulationGrowthRate = reader.ReadInt32(); MetalConsumption = reader.ReadInt32(); StoneConsumption = reader.ReadInt32(); WoodConsumption = reader.ReadInt32(); LeatherConsumption = reader.ReadInt32(); ClothConsumption = reader.ReadInt32(); AlchemyConsumption = reader.ReadInt32(); ChemicalConsumption = reader.ReadInt32(); IndustrialConsumption = reader.ReadInt32(); MedicineConsumption = reader.ReadInt32(); FoodConsumption = reader.ReadInt32(); break; } if (i < blockCount - 1) { stream.Seek(nextBlock, SeekOrigin.Begin); } } }
public KingOfFools(Tiles t) : base(t, null, "King") { _strat = new KingOFFoolishness(Name()); }
public override void Paint(Level level) { Painter.Fill(level, this, 1, Tile.Chasm); Painter.Fill(level, this, (int)(Math.Min(GetWidth(), GetHeight()) / 2f) - 1, Tiles.RandomFloor()); foreach (var d in Connected.Values) { Painter.Fill(level, d.X - 1, d.Y - 1, 3, 3, Tiles.RandomFloor()); } for (var i = 0; i < Rnd.Int(1, 5); i++) { var item = Items.CreateAndAdd(Items.Generate(ItemPool.Consumable), level.Area); item.Center = GetCenter() * 16 + new Vector2(Rnd.Float(-4, 4), Rnd.Float(-4, 4)); } if (GlobalSave.IsTrue("saved_npc")) { for (var i = 0; i < Rnd.Int(1, Run.Depth); i++) { var item = Items.CreateAndAdd("bk:emerald", level.Area); item.Center = GetCenter() * 16 + new Vector2(Rnd.Float(-4, 4), Rnd.Float(-4, 4)); } } }
protected override bool HasUpdate(uint gameTick) { if (!(_update || _fullRedraw)) { return(false); } if (Game.MovingUnit == null && (gameTick % 2 == 1)) { return(false); } Player renderPlayer = Settings.RevealWorld ? null : Human; IUnit activeUnit = ActiveUnit; if (Game.MovingUnit != null && !_fullRedraw) { IUnit movingUnit = Game.MovingUnit; ITile tile = movingUnit.Tile; int dx = GetX(tile); int dy = GetY(tile); if (dx < _tilesX && dy < _tilesY) { dx *= 16; dy *= 16; MoveUnit movement = movingUnit.Movement; this.FillRectangle(dx - 16, dy - 16, 48, 48, 5) .AddLayer(Map[movingUnit.X - 1, movingUnit.Y - 1, 3, 3].ToBitmap(player: renderPlayer), dx - 16, dy - 16, dispose: true); Bytemap unitPicture = movingUnit.ToBitmap(); this.AddLayer(unitPicture, dx + movement.X, dy + movement.Y); if (movingUnit is IBoardable && tile.Units.Any(u => u.Class == UnitClass.Land && (tile.City == null || (tile.City != null && u.Sentry)))) { this.AddLayer(unitPicture, dx + movement.X - 1, dy + movement.Y - 1); } return(true); } } else if (_fullRedraw) { _fullRedraw = false; this.Clear(5) .AddLayer(Tiles.ToBitmap(player: renderPlayer), dispose: true); } if (activeUnit != null && Game.CurrentPlayer == Human && !GameTask.Any()) { ITile tile = activeUnit.Tile; int dx = GetX(tile); int dy = GetY(tile); if (dx < _tilesX && dy < _tilesY) { dx *= 16; dy *= 16; // blink status TileSettings setting = ((gameTick % 4) < 2) ? TileSettings.BlinkOn : TileSettings.BlinkOff; this.AddLayer(tile.ToBitmap(setting), dx, dy, dispose: true); DrawHelperArrows(dx, dy); } return(true); } _update = false; return(true); }
static void Main(string[] args) { // Initialization Console.WriteLine(""); Console.WriteLine("PoP 1 Sprites Converter v1.0 - (C)2016 Marcelo Lv Cabral"); Console.WriteLine("Convert bmp extracted from PoP 1 dat files into png frames and sheets"); Console.WriteLine("<< Focused on converting Mods to Prince of Persia for Roku >>"); Console.WriteLine("<< Source code is avaliable at: http://github.com/lvcabral >>"); if (args.Length >= 2) { if (!Directory.Exists(args[0])) { Console.WriteLine("PR resources folder does not exist!"); return; } if (!Directory.Exists(args[1])) { Console.WriteLine("Output folder does not exist!"); return; } bool wda = false; if (args.Length > 2) { if (args[2].ToLower().Trim() == "-wda") { wda = true; } else { help(); return; } } // Convert Sprites bool ok = Tiles.convertTiles("dungeon", args[0], args[1]); if (ok) { ok = Tiles.convertTiles("palace", args[0], args[1], wda); } if (ok && File.Exists(Path.Combine(args[0], @"prince\binary\level color variations.pal"))) { if (ok) { ok = Tiles.convertTiles("dungeon", args[0], args[1], wda, 0); } if (ok) { ok = Tiles.convertTiles("dungeon", args[0], args[1], wda, 1); } if (ok) { ok = Tiles.convertTiles("dungeon", args[0], args[1], wda, 2); } if (ok) { ok = Tiles.convertTiles("palace", args[0], args[1], wda, 3); } } if (ok) { ok = Kid.convertKid(args[0], args[1]); } if (ok) { ok = Guards.convertGuards(args[0], args[1]); } if (ok) { ok = Guards.convertSpecialGuards(args[0], args[1]); } if (ok) { ok = Actors.convertActors(args[0], args[1]); } if (ok) { ok = General.convertGeneral(args[0], args[1]); } if (ok) { ok = Scenes.convertScenes(args[0], args[1]); } if (ok) { ok = Titles.convertTitles(args[0], args[1]); } if (!ok) { Console.ReadKey(); } } else { help(); } }
public Boring(Tiles t ) : base(t, new FirstTileStratedgy(), GenerateName()) { }
public TexturePrev(TexturePrev g) : base(g) { tileType = g.tileType; text = (TextSprite)g.text.Clone(); }
public bool putOn(Pawn p,Tiles t) { if (p.race is Elf || p.race is Orc) { if (t is Water) {return false; } else { p.position = this; this.Pawns.Add(p); return true; } } else { p.position = this; this.Pawns.Add(p); return true; } }
public void SetPosFromStartId(Tiles tiles, Vector3 pos) { position = tiles.GetTilePos(startTileId) - pos; }