Esempio n. 1
0
    /* Returns DoorRecords from doors. */
    public List <DoorRecord> GetDoors()
    {
        List <DoorRecord> ret = new List <DoorRecord>();

        foreach (GameObject door in doors)
        {
            WarpDoor wd = door.GetComponent <WarpDoor>();
            if (wd != null)
            {
                ret.Add(wd.GetRecord());
            }
        }
        return(ret);
    }
Esempio n. 2
0
    public int id;              // Id of this door within its room.

    /* WarpDoor constructor. */
    public DoorRecord(WarpDoor wd)
    {
        x        = wd.x;
        y        = wd.y;
        building = wd.building;
        destName = wd.destName;
        room     = wd.room;

        exterior       = wd.exterior;
        exteriorFacing = wd.exteriorFacing;

        destId = wd.destId;
        id     = wd.id;
    }
Esempio n. 3
0
    public void CreateItem(Data dat)
    {
        if (dat == null)
        {
            return;
        }
        Vector3 sPos = new Vector3(dat.x, dat.y, dat.z);

        sPos += position;
        if (dat.displayName == "Spawner")
        {
            dat.x = sPos.x;
            dat.y = sPos.y;
            dat.z = sPos.z;
        }

        Quaternion rot  = Quaternion.Euler(new Vector3(dat.xr, dat.yr, dat.zr));
        GameObject pref = (GameObject)Resources.Load("Prefabs/" + dat.prefabName, typeof(GameObject));
        GameObject go   = (GameObject)GameObject.Instantiate(pref, sPos, rot);
        Item       item = go.GetComponent <Item>();

        if (item)
        {
            item.LoadData(dat);
            if (item is WarpDoor)
            {
                WarpDoor w = item as WarpDoor;
                w.deck = deck.id;
                w.LoadRecord(deck.GetDoor(cell, w.id));
                if (spawnDoor == -1 || w.id == spawnDoor)
                {
                    spawnPos = w.DestPos();
                    spawnRot = w.DestRot();
                }
            }
        }
        go.transform.position = sPos;
    }