Exemplo n.º 1
0
 public override bool CanUse(GameManagerScript gameManager, GridScript grid, TileInformation tile)
 {
     return true;
 }
Exemplo n.º 2
0
        public override void Action(GameManagerScript gameManager, GridScript grid, TileInformation tile)
        {
            if (tile != _tile) return;

            var tileList = grid.TileList;
            var tileScript = grid.TileList.FirstOrDefault(x => x.TileInformation == tile);

            if (tileScript != null)
            {
                if (tileScript.Y%2 == 0)
                {
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 0))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 0);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X + 1 && ts.Y == tileScript.Y + 0))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X + 1 && ts.Y == tileScript.Y + 0);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y + 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y + 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                }
                else
                {
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 0))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y + 0);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X + 0 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                    if (tileList.Any(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1))
                    {
                        var buffTile = tileList.First(ts => ts.X == tileScript.X - 1 && ts.Y == tileScript.Y - 1);
                        buffTile.TileInformation.DeltaInf *= 2;
                        buffTile.TileInformation.DeltaMoney *= 2;
                    }
                }
            }

        }
Exemplo n.º 3
0
 public override void Action(GameManagerScript gameManager, GridScript grid, TileInformation tile)
 {
     tile.AreActionsEnabled = true;
 }
Exemplo n.º 4
0
 public AllBuildingBuff(TileInformation tile)
 {
     _tile = tile;
 }
Exemplo n.º 5
0
 public override bool CanUse(GameManagerScript gameManager, GridScript grid, TileInformation tile)
 {
     return gameManager.People >= 3;
 }
Exemplo n.º 6
0
        public override void Action(GameManagerScript gameManager, GridScript grid, TileInformation tile)
        {
            gameManager.Souls += 3;

            gameManager.People -= 3;
            gameManager.Not += 1;

            tile.AreActionsEnabled = false;
        }
Exemplo n.º 7
0
        public override void Action(GameManagerScript gameManager, GridScript grid, TileInformation tile)
        {
            if (_tile.BonusReceived) return;

            var neighbours = grid.GetNeighbours(grid.TileList.First(t => t.TileInformation == _tile));

            var influenceCount = 0;
            foreach (var neighbour in neighbours)
            {
                influenceCount += neighbour.TileInformation.DeltaInf;
                influenceCount -= neighbour.TileInformation.DeltaNot;
            }

            if (influenceCount >= 10)
            {
                Debug.Log("Got Bonus!!!!");

                _tile.BonusReceived = true;
                gameManager.People += 10;
            }
        }
Exemplo n.º 8
0
 public abstract void Action(GameManagerScript gameManager, GridScript grid, TileInformation tile);
Exemplo n.º 9
0
 public abstract bool CanUse(GameManagerScript gameManager, GridScript grid, TileInformation tile);
Exemplo n.º 10
0
        public void OnTileAdded(TileInformation tileInformation)
        {
            CanEndTurn = true;

            PurchasableTile1.gameObject.SetActive(false);
            PurchasableTile2.gameObject.SetActive(false);
            PurchasableTile3.gameObject.SetActive(false);

            foreach (var tile in TileGrid.TileList)
            {
                if (tile.TileInformation.OnPlacement != null)
                {
                    tile.TileInformation.OnPlacement.Action(this, TileGrid, tileInformation);
                }
                
            }

            var income = TileGrid.GetIncome();
            PreviousIncome = income;
        }
Exemplo n.º 11
0
        public TileInformation[] GetPurchasableTileInformation()
        {
            var tileInfo = new TileInformation[3];
            var listArray = new List<int> { 0, 1, 2, 3, 4, 5 };

            if (Not > 3)
            {
                var Percentage = Not - 3;

                Percentage *= 10;

                var chance = Random.Range(0, 100);

                if (chance < Percentage)
                {
                    var building = Random.Range(0, 2);

                    if (building == 0)
                    {
                        return new[] { new PoliceStationInformation(), new PoliceStationInformation(), new PoliceStationInformation()};
                        CanEndTurn = false;
                    }
                    else
                    {
                        return new[] { new ChurchInformation(), new ChurchInformation(), new ChurchInformation() };
                        CanEndTurn = false;
                    }
                }
            }

            var value1 = Random.Range(0, listArray.Count);
            tileInfo[0] = GetTileFromId(listArray[value1]);
            listArray.Remove(value1);

            var value2 = Random.Range(0, listArray.Count);
            tileInfo[1] = GetTileFromId(listArray[value2]);
            listArray.Remove(value2);

            var value3 = Random.Range(0, listArray.Count);
            tileInfo[2] = GetTileFromId(listArray[value3]);

            return tileInfo;
        }