Exemplo n.º 1
0
    public void RazeEdges(TileScript t)
    {
        // remove all loose edges
        foreach (var d in this.Map.Directions.Where(x => t.GetEdge(x).Opposite(t) == null))
        {
            this.Map.KillEdge(t.GetEdge(d));
        }

        // downgrade rest (but Indoor -> Outdoor, skipping an extra step)
        this.Map.DowngradeEdges(t);
    }
Exemplo n.º 2
0
    public List <Direction> GetFreeEdgeDirections(TileScript t)
    {
        var free = new List <Direction>();

        foreach (var d in this.Directions)
        {
            if (t.GetEdge(d) == null)
            {
                free.Add(d);
            }
        }

        return(free);
    }
Exemplo n.º 3
0
    // null -> outdoor -> none -> indoor
    // (only after pull edges btw)

    public void UpgradeEdges(TileScript t)
    {
        foreach (var d in this.Directions)
        {
            var e = t.GetEdge(d);
            if (e == null)
            {
                e = this.CreateEdge(t.Position, d);
                t.SetEdge(d, e);
            }

            var wt = (WallType)((int)e.Wall + 1);
            this.SetWall(e, (WallType)((int)e.Wall + 1));
        }
    }
Exemplo n.º 4
0
    // game object wise, not model wise
    public GameObject SpawnWall(TileScript t, Direction d)
    {
        var w      = Instantiate(this.Wall);
        var wt     = w.transform;
        var center = t.transform.Find("Center");

        wt.position    = center.position;
        wt.eulerAngles = new Vector3(wt.eulerAngles.x, ((int)d) * 90, wt.eulerAngles.z);

        // place into the hierarchy
        wt.parent = this.Walls.transform;

        t.GetEdge(d).EdgeObject = w;

        return(w);
    }
Exemplo n.º 5
0
    // indoor -2-> none -> outdoor -> null
    // (down indoor twice)

    public void DowngradeEdges(TileScript t)
    {
        foreach (var d in this.Directions)
        {
            var e = t.GetEdge(d);
            if (e == null)
            {
                continue;
            }

            switch (e.Wall)
            {
            case WallType.Indoor:
            case WallType.None:
                this.SetWall(e, WallType.Outdoor);
                break;

            case WallType.Outdoor:
                this.KillEdge(e);
                break;
            }
        }
    }