Ejemplo n.º 1
0
        private void Start()
        {
            var map  = Config.instance.map;
            var size = new Vector2Int(map.terrainArray.Length, map.terrainArray[0].Length);

            // check to load data
            if (GameData.dataToLoad != null)
            {
                var data = GameData.dataToLoad;
                for (int x = 0; x < size.x; ++x)
                {
                    for (int y = 0; y < size.y; ++y)
                    {
                        data.tombstones[x][y]?.Load();
                        data.terrains[x][y].Load();
                        data.units[x][y]?.Load();
                    }
                }
            }
            else
            {
                var index = new Vector3Int();
                for (index.x = 0; index.x < size.x; ++index.x)
                {
                    for (index.y = 0; index.y < size.y; ++index.y)
                    {
                        var wPos = index.ArrayToWorld();
                        AETerrain.DeSerialize(map.terrainArray[index.x][index.y], wPos);
                        Unit.DeSerialize(map.unitArray[index.x][index.y], wPos);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public bool CanOccupy(AETerrain terrain) =>
 terrain is IOccupyable && (terrain as IOccupyable).army?.group != army.group;
Ejemplo n.º 3
0
 public bool CanOccupy(AETerrain terrain) =>
 terrain is House && (terrain as House).army?.group != army.group;