Пример #1
0
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var data = new CityComponent(cityGameObject.transform.position, city, healthyPopulation, sickPopulation, moral, industry, sicknessRate, sicknessDetectionLevel, infrastructureLevel, quarantineLevel);

        dstManager.AddComponentData(entity, data);

        dstManager.AddSharedComponentData(entity, new RenderMesh
        {
            //mesh = PolygonalMesh(30f, 5),
            mesh     = DoubleSidedPolygonalMesh(30f, 10f, 16),
            material = new Material(circleMaterial)
        });
    }
Пример #2
0
 public City(Hex hex, Player player)
 {
     this.Player = player;
     //ResourceBalance = new Resources(Player.ResourceBalance);
     mainHex         = hex;
     hex.MainCityHex = true;
     Hexes           = new List <Hex>();
     AddHex(hex);
     foreach (Hex h in hex.GetNeightbours())
     {
         AddHex(h);
     }
     Population     = 1;
     Name           = "TestCity";
     CityGameObject = GameObject.Instantiate(Player.cityPrefab);
     CityGameObject.transform.position += hex.Position();
     cityComponent = CityGameObject.AddComponent <CityComponent>();
     cityComponent.CityGameObject = CityGameObject;
     cityComponent.CityLogic      = this;
     UnitsInCity      = new List <Unit>();
     this.unitsAssets = this.Player.gameManager.UnitDatabase;
     UnitInCityNumber = 0;
 }