Exemplo n.º 1
0
    // static


    public static Ruin InstantiateRuin(Ruin prefab, Vector3 point, Ruins _ruins)
    {
        Ruin _ruin = Instantiate(prefab, point, _ruins.transform.rotation, _ruins.transform);

        _ruin.transform.localScale += new Vector3(4, 16, 4);
        _ruin.transform.position   += new Vector3(0, _ruin.transform.localScale.y / 2, 0);
        _ruin.SetComponents();

        return(_ruin);
    }
Exemplo n.º 2
0
    // Unity


    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("More than one ruins instance");
            Destroy(this);
            return;
        }
        Instance = this;
    }
Exemplo n.º 3
0
    public static RuinComplex New(Grid _grid, Ruin prefab, Ruins _ruins)
    {
        RuinComplex _complex = new RuinComplex
        {
            Grid       = _grid,
            RuinBlocks = new List <Ruin>(),
        };

        foreach (var location in _complex.Grid.Elements)
        {
            if (Random.Range(0, 99) < 40)
            {
                Ruin _ruin = Ruin.InstantiateRuin(prefab, location, _ruins);
                _complex.RuinBlocks.Add(_ruin);
            }
        }

        return(_complex);
    }
Exemplo n.º 4
0
    public static MapCell create_cell(int ID, int tier, Tile tile, Pos pos)
    {
        MapCell mc = null;

        // Don't extract name from tile if provided.
        if (ID == PLAINS_ID)
        {
            mc = new Plains(tier, tile, pos);
        }
        else if (ID == FOREST_ID)
        {
            mc = new Forest(tier, tile, pos);
        }
        else if (ID == RUINS_ID)
        {
            mc = new Ruins(tier, tile, pos);
        }
        else if (ID == CLIFF_ID)
        {
            mc = new Cliff(tier, tile, pos);
        }
        else if (ID == CAVE_ID)
        {
            mc = new Cave(tier, tile, pos);
        }
        else if (ID == STAR_ID)
        {
            mc = new Star(tier, tile, pos);
        }
        else if (ID == TITRUM_ID)
        {
            mc = new Titrum(tier, tile, pos);
        }
        else if (ID == LUSH_LAND_ID)
        {
            mc = new LushLand(tier, tile, pos);
            //} else if (name == MIRE) {
            //mc = new Mire(tier, tile, pos);
        }
        else if (ID == MOUNTAIN_ID)
        {
            mc = new Mountain(tier, tile, pos);
        }
        else if (ID == SETTLEMENT_ID)
        {
            mc = new Settlement(tier, tile, pos);
        }
        else if (ID == RUNE_GATE_ID)
        {
            mc = new RuneGate(tier, tile, pos);
        }
        else if (ID == CITY_ID)
        {
            mc = new CityCell(tier, tile, pos);
        }
        else if (ID == GUARDIAN_PASS_ID)
        {
            mc = new GuardianPass(tier, tile, pos);
        }
        else if (ID == CITY_ID)
        {
            mc = new CityCell(tier, tile, pos);
        }
        else
        {
            mc = new MapCell(0, tier, tile, pos);
        }
        //mc.tile_type_ID = tile_type_ID;
        return(mc);
    }