Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        World = new World(Threaded);

        //ActiveFeatures = SimFeature.All;
        //ActiveFeatures &= ~(SimFeature.Evaporation);
        //		ActiveFeatures &= ~(SimFeature.TradeWinds);

        Data.Init(WorldGenData.Size);
        WorldGen.Generate(World, SpeciesSprites, Data, WorldGenData, Seed);
        CreateWorldMesh();
        MainCamera.transform.position = new Vector3(World.Size / 2, World.Size / 2, MainCamera.transform.position.z);

        _windArrows = new GameObject[World.Size * World.Size];
        for (int i = 0; i < World.Size; i++)
        {
            for (int j = 0; j < World.Size; j++)
            {
                var a = GameObject.Instantiate <GameObject>(ArrowPrefab, this.transform);
                a.transform.position = new Vector3(i, j, 0);
                a.SetActive(false);
                a.hideFlags = HideFlags.HideInHierarchy;
                _windArrows[i + j * World.Size] = a;
            }
        }

        _herdIcons = new HerdIcon[World.MaxHerds];
        for (int i = 0; i < World.MaxHerds; i++)
        {
            var icon = HerdIcon.Instantiate <HerdIcon>(HerdIconPrefab, WorldIcons.transform);
            icon.gameObject.hideFlags = HideFlags.HideInHierarchy;
            icon.World = this;
            icon.gameObject.SetActive(false);
            _herdIcons[i] = icon;
        }

        _territoryMarkers = new GameObject[Herd.MaxActiveTiles];
        for (int i = 0; i < Herd.MaxActiveTiles; i++)
        {
            var marker = GameObject.Instantiate <GameObject>(TerritoryMarker, WorldIcons.transform);
            marker.gameObject.hideFlags = HideFlags.HideInHierarchy;
            marker.gameObject.SetActive(false);
            _territoryMarkers[i] = marker;
        }

        WorldStartedEvent?.Invoke();
        HerdSelected = -1;

        World.Start();
    }