public Tile() { type = TypeTile.NONE; propetries = Properties.SOFT; TileRect = new IntRect(setRect(12), setRect(4), 16, 16); }
private void MainForm_Load(object sender, EventArgs e) { chosen = TypeTile.UP; map = new Map(); map.GetPictureBox.MouseClick += GetPictureBox_MouseClick; this.Controls.Add(map.GetPictureBox); map.update(); signals = new List <Signal>(); }
public Tile(TypeTile tpTile, double x, double y) { this.tpTile = tpTile; vetor[0] = x * Size[0]; vetor[1] = y * Size[1]; Path = "/Assets/Images/tiles/" + tpTile + ".png"; VirtualPosition[0] = vetor[0]; VirtualPosition[1] = vetor[1] - Matriz.scale * 0.6; }
public Tile(string[] tileData) { try { Name = tileData[0]; IndexTypeObjet = (Convert.ToInt32(tileData[5]) - 1) * 32 + (Convert.ToInt32(tileData[4]) - 1); Category = tileData[2].ToLower(); Bitmap = _bitmaps[tileData[3]]; NumberOfFrames = Convert.ToInt32(tileData[7]); Rectangle = new Rectangle((Convert.ToInt32(tileData[4]) - 1) * TileSizeX, (Convert.ToInt32(tileData[5]) - 1) * TileSizeY, TileSizeX * NumberOfFrames, TileSizeY); X_Image = (Convert.ToInt32(tileData[4]) - 1); Y_Image = (Convert.ToInt32(tileData[5]) - 1); IsTransparent = (tileData[6].ToLower() == "y"); IsBlock = ((tileData[8].ToLower()) == "block"); //Some types of tiles have a color if (Category == "door" || Category == "key") { Color = tileData[9].ToLower(); } //Some types of tiles have health if (Category == "character") { Health = Convert.ToInt32(tileData[9]); } //Définir le type d'objet switch (tileData[10]) { case "Objet": TypeObjet = TypeTile.ObjetMonde; break; case "Monstre": TypeObjet = TypeTile.Monstre; break; case "Item": TypeObjet = TypeTile.Item; break; } } catch (Exception ex) { Console.WriteLine(ex.Message); foreach (string s in tileData) { Console.WriteLine(s); } } }
public Tile(string[] tileData) { try { Name = tileData[0]; IndexTypeObjet = Convert.ToInt32(tileData[1]); Category = tileData[2].ToLower(); Bitmap = _bitmaps[tileData[3]]; NumberOfFrames = Convert.ToInt32(tileData[7]); Rectangle = new Rectangle((Convert.ToInt32(tileData[4]) - 1) * TileSizeX, (Convert.ToInt32(tileData[5]) - 1) * TileSizeY, TileSizeX * NumberOfFrames, TileSizeY); X_Image = (Convert.ToInt32(tileData[4]) - 1); Y_Image = (Convert.ToInt32(tileData[5]) - 1); IsTransparent = (tileData[6].ToLower() == "y"); IsBlock = ((tileData[8].ToLower()) == "block"); //Some types of tiles have a color if (Category == "door" || Category == "key") Color = tileData[9].ToLower(); //Some types of tiles have health if (Category == "character") Health = Convert.ToInt32(tileData[9]); //Définir le type d'objet switch (tileData[10]) { case "Objet": TypeObjet = TypeTile.ObjetMonde; break; case "Monstre": TypeObjet = TypeTile.Monstre; break; case "Item": TypeObjet = TypeTile.Item; break; } } catch (Exception ex) { Console.WriteLine(ex.Message); foreach (string s in tileData) Console.WriteLine(s); } }
public void ChangeWall(Direction direction, GameObject wall, TypeWall type) { switch (direction) { case Direction.Left: { ClearChildrens(this.walls.Left.Point); if (wall) { Instantiate(wall, this.walls.Left.Point); } this.walls.Left.Type = type; } break; case Direction.Right: { ClearChildrens(this.walls.Right.Point); if (wall) { Instantiate(wall, this.walls.Right.Point); } this.walls.Right.Type = type; } break; case Direction.Up: { ClearChildrens(this.walls.Up.Point); if (wall) { Instantiate(wall, this.walls.Up.Point); } this.walls.Up.Type = type; } break; case Direction.Down: { ClearChildrens(this.walls.Down.Point); if (wall) { Instantiate(wall, this.walls.Down.Point); } this.walls.Down.Type = type; } break; } ShowPillars(direction); }
public void WaitAndPraise() { Debug.Log("WaitingAndPraise"); waitTile = TileManager.Instance.tileTarget.typeTile; if (waitReward >= praiseReward) { waitReward = waitReward + praiseReward; } else { waitReward = waitReward + praiseReward; } SetTrainingPopup(false); }
public void WaitAndPunish() { Debug.Log("WaitingAndPunish"); waitTile = TileManager.Instance.tileTarget.typeTile; if (waitReward <= punishReward) { waitReward = waitReward + punishReward; } else { waitReward = waitReward + punishReward; } SetTrainingPopup(false); }
private static bool IsCorrectTile(TypeTile[] targets, TypeTile tileToCompare) { if (targets == null) { return(false); } for (int i = targets.Length - 1; i >= 0; --i) { if (tileToCompare.Equals(targets[i])) { return(true); } } return(false); }
private void GetPictureBox_MouseClick(object sender, MouseEventArgs e) { if (up_radio.Checked) { chosen = TypeTile.UP; } if (down_radio.Checked) { chosen = TypeTile.DOWN; } if (left_radio.Checked) { chosen = TypeTile.LEFT; } if (right_radio.Checked) { chosen = TypeTile.RIGHT; } if (empty_radio.Checked) { chosen = TypeTile.EMPTY; } if (andup_radio.Checked) { chosen = TypeTile.ANDUP; } if (signal_radio.Checked) { chosen = TypeTile.NULL; if (e.X <= 500 && e.Y <= 500 && e.X >= 0 && e.Y >= 0) { signals.Add(new Signal(new Point(e.X / 5, e.Y / 5))); this.Controls.Remove(map.GetPictureBox); this.Controls.Add(signals[signals.Count - 1].pbox); this.Controls.Add(map.GetPictureBox); signal_timer.Enabled = true; } } if (e.X <= 500 && e.Y <= 500 && e.X >= 0 && e.Y >= 0 && chosen != TypeTile.NULL) { map[e.X / 5, e.Y / 5].change(chosen); map[e.X / 5, e.Y / 5].draw(); } }
public void UpdatePopup(TypeTile typeTile) { trainable = true; Sprite targetSprite = GetTileSprite(); Sprite actionSprite = null; if (iconLib == null) { iconLib = (IconLibrary)FindObjectOfType(typeof(IconLibrary)); } if (typeTile == TypeTile.FoodTile) { actionSprite = iconLib.GetIcon("Eat"); } else if (typeTile == TypeTile.RestTile) { actionSprite = iconLib.GetIcon("Sleep"); } SetLayout(null, null, targetSprite, actionSprite); }
void GenerateRewardCollectables(Vector2Int sizeMaze, TileEntity[,] tiles, TypeTile setType, GameObject rewardCollectableObject, int countCollectables) { if (sizeMaze == null || tiles == null) { Debug.LogError("Отсутствует игровое поле для установки игровых обьектов для награждения!"); } else if (rewardCollectableObject == null) { Debug.LogError("Требуемый шаблон игрового обьекта для награждения отсутствует!"); } else if ((sizeMaze.x * sizeMaze.y) < countCollectables || countCollectables <= 0) { Debug.LogError("Количество награждаемых игровых объектов должен быть в пределах от 1 до площади игрового пространства!"); } else { for (int i = 0; i < countCollectables; i++) { int x = Random.Range(0, sizeMaze.x - 1); int y = Random.Range(0, sizeMaze.y - 1); if (tiles[x, y].Type == TypeTile.Null) { GameObject collect = rewardCollectableObject; tiles[x, y].SpawnOnFloor(collect); tiles[x, y].gameObject.name += (" " + setType.ToString()); tiles[x, y].Type = setType; } else { i--; } } Debug.Log("Установка награждаемых игровых объектов выполнена!"); } }
void Awake() { typeTileOnStartGame = typeTile; }
public void change(TypeTile t) { type = t; }
public void setMaterial(int random) { switch (type) { case TypeTile.GROUND: { if (UpSosed && DownSosed && RighSosed && LeftSosed) // все соседи { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(1), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(1), 16, 16); break; } } else if (!UpSosed && !DownSosed && !RighSosed && !LeftSosed) // ни одного соседа { switch (random) { case 1: TileRect = new IntRect(setRect(9), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(10), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(11), setRect(3), 16, 16); break; } } else if (!UpSosed && DownSosed && RighSosed && LeftSosed) // нет верхнего соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(0), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(0), 16, 16); break; } } else if (UpSosed && !DownSosed && RighSosed && LeftSosed) // нет нижнего соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(2), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(2), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(2), 16, 16); break; } } else if (UpSosed && DownSosed && !RighSosed && LeftSosed) // нет правого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(4), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(4), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(2), 16, 16); break; } } else if (UpSosed && DownSosed && RighSosed && !LeftSosed) // нет левого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(0), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(0), setRect(2), 16, 16); break; } } else if (!UpSosed && !DownSosed && RighSosed && LeftSosed) // нет верхнего и нижнего { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(7), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(8), setRect(4), 16, 16); break; } } else if (UpSosed && DownSosed && !RighSosed && !LeftSosed) // нет правого и левого { switch (random) { case 1: TileRect = new IntRect(setRect(5), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(5), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(2), 16, 16); break; } } else if (!UpSosed && DownSosed && !RighSosed && LeftSosed) // нет верхнего и правого { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(3), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(3), 16, 16); break; } } else if (!UpSosed && DownSosed && RighSosed && !LeftSosed) // нет верхнего и левого { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(3), 16, 16); break; } } else if (UpSosed && !DownSosed && !RighSosed && LeftSosed) // нет нижнего и правого { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(3), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(4), 16, 16); break; } } else if (UpSosed && !DownSosed && RighSosed && !LeftSosed) // нет нижнего и левого { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(4), 16, 16); break; } } else if (UpSosed && !DownSosed && !RighSosed && !LeftSosed) // есть верхний { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(7), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(8), setRect(3), 16, 16); break; } } else if (!UpSosed && DownSosed && !RighSosed && !LeftSosed) // есть нижний { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(7), setRect(0), 16, 16); break; case 3: TileRect = new IntRect(setRect(8), setRect(0), 16, 16); break; } } else if (!UpSosed && !DownSosed && RighSosed && !LeftSosed) // есть правый { switch (random) { case 1: TileRect = new IntRect(setRect(9), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(9), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(9), setRect(2), 16, 16); break; } } else if (!UpSosed && !DownSosed && !RighSosed && LeftSosed) // есть левый { switch (random) { case 1: TileRect = new IntRect(setRect(12), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(12), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(12), setRect(2), 16, 16); break; } } } break; case TypeTile.GRASS: if (UpSosed && DownSosed && RighSosed && LeftSosed) // все соседи { type = TypeTile.GROUND; switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(1), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(1), 16, 16); break; } } else if (!UpSosed && !DownSosed && !RighSosed && !LeftSosed) // Нет соседей { switch (random) { case 1: TileRect = new IntRect(setRect(9), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(10), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(11), setRect(3), 16, 16); break; } } else if (!UpSosed && DownSosed && RighSosed && LeftSosed) // нет верхнего соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(0), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(0), 16, 16); break; } } else if (UpSosed && !DownSosed && RighSosed && LeftSosed) // Нет нижнего соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(2), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(2), 16, 16); break; case 3: TileRect = new IntRect(setRect(3), setRect(2), 16, 16); break; } } else if (UpSosed && DownSosed && !RighSosed && LeftSosed) // Нет правого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(4), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(4), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(2), 16, 16); break; } } else if (UpSosed && DownSosed && RighSosed && !LeftSosed) // Нет левого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(0), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(0), setRect(2), 16, 16); break; } } else if (!UpSosed && !DownSosed && RighSosed && LeftSosed) // Нет верхнего и нижнего соседа { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(7), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(8), setRect(4), 16, 16); break; } } else if (UpSosed && DownSosed && !RighSosed && !LeftSosed) // Нет правого и левого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(5), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(5), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(2), 16, 16); break; } } else if (!UpSosed && DownSosed && !RighSosed && LeftSosed) // Нет верхнего и правого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(3), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(3), 16, 16); break; } } else if (!UpSosed && DownSosed && RighSosed && !LeftSosed) // Нет верхнего и левого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(3), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(3), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(3), 16, 16); break; } } else if (UpSosed && !DownSosed && !RighSosed && LeftSosed) // Нет нижнего и правого соседа { switch (random) { case 1: TileRect = new IntRect(setRect(1), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(3), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(5), setRect(4), 16, 16); break; } } else if (UpSosed && !DownSosed && RighSosed && !LeftSosed) // нет нижнего и правого { switch (random) { case 1: TileRect = new IntRect(setRect(0), setRect(4), 16, 16); break; case 2: TileRect = new IntRect(setRect(2), setRect(4), 16, 16); break; case 3: TileRect = new IntRect(setRect(4), setRect(4), 16, 16); break; } } else if (UpSosed && !DownSosed && !RighSosed && !LeftSosed) // есть верхний { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(8), 16, 16); break; case 2: TileRect = new IntRect(setRect(6), setRect(9), 16, 16); break; case 3: TileRect = new IntRect(setRect(6), setRect(10), 16, 16); break; } } else if (!UpSosed && DownSosed && !RighSosed && !LeftSosed) // есть нижний { switch (random) { case 1: TileRect = new IntRect(setRect(6), setRect(5), 16, 16); break; case 2: TileRect = new IntRect(setRect(6), setRect(6), 16, 16); break; case 3: TileRect = new IntRect(setRect(6), setRect(7), 16, 16); break; } } else if (!UpSosed && !DownSosed && RighSosed && !LeftSosed) // есть правый { switch (random) { case 1: TileRect = new IntRect(setRect(9), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(9), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(9), setRect(2), 16, 16); break; } } else if (!UpSosed && !DownSosed && !RighSosed && LeftSosed) // есть левый { switch (random) { case 1: TileRect = new IntRect(setRect(12), setRect(0), 16, 16); break; case 2: TileRect = new IntRect(setRect(12), setRect(1), 16, 16); break; case 3: TileRect = new IntRect(setRect(12), setRect(2), 16, 16); break; } } break; case TypeTile.NONE: TileRect = new IntRect(setRect(12), setRect(4), 16, 16); break; } }
public TileCategory(int id,TypeTile type) :this() { Id = id; TypeTile = type; }
public void Reset() { typeTile = typeTileOnStartGame; }
public Tile(PointB ind, TypeTile t) { index = ind; type = t; bmp = new Bitmap((int)TileSize, (int)TileSize); }
public TileCategory(int id, TypeTile type) : this() { Id = id; TypeTile = type; }
public void SetStartTypeTile(TypeTile _typeTile) { typeTile = _typeTile; typeTileOnStartGame = _typeTile; }
public Tile(PointB ind) { index = ind; type = TypeTile.EMPTY; bmp = new Bitmap((int)TileSize, (int)TileSize); }