예제 #1
0
    public override void Initialise(WorldManager worldManager)
    {
        seed = worldSeed + (int)transform.position.x + (int)transform.position.y;
        System.Random random = new System.Random(seed);

        if (randomiseDirection)
        {
            direction = (Village.Direction)random.Next(0, 4);
        }

        if (!usePrefabBuilding)
        {
            Array type = Enum.GetValues(typeof(BuildingType));
            Array size = Enum.GetValues(typeof(BuildingSize));

            buildingType = (BuildingType)type.GetValue(random.Next(type.Length));
            buildingSize = (BuildingSize)type.GetValue(random.Next(size.Length));

            base.Initialise(worldManager);
        }
        else
        {
            if (useRandomPrefabBuilding)
            {
                prefab = worldManager.buildingPrefabs[random.Next(0, worldManager.buildingPrefabs.Length)];
            }

            Generate(prefab);
        }

        StartCoroutine(SpawnCollectable());
    }
예제 #2
0
    public void Initialise(int seed, TilemapPrefab building, Village.Direction direction)
    {
        this.seed = seed + (int)transform.position.x + (int)transform.position.y;

        //System.Random rand = new System.Random(this.seed);
        prefab         = building;
        this.direction = direction;
        Generate(prefab);

        StartCoroutine(SpawnCollectable());
    }
예제 #3
0
    public void Initialise(int seed, TilemapPrefab[] potentialBuildings, Village.Direction direction)
    {
        this.seed = seed + (int)transform.position.x + (int)transform.position.y;

        System.Random rand = new System.Random(this.seed);
        prefab         = potentialBuildings[rand.Next(0, potentialBuildings.Length)];
        this.direction = direction;
        Generate(prefab);

        StartCoroutine(SpawnCollectable());
    }