Пример #1
0
    protected virtual RoomParts.RoomPart ConfigureFloorPart(string partName, Vector2 partSize)
    {
        RoomParts.RoomPart floorPart = Instantiate(m_skin.floor);
        floorPart.Configure(m_floorStructure, partName + " floor", partSize);

        return(floorPart);
    }
Пример #2
0
        public virtual void Configure(Transform parent, string partName, Vector2 size, float bottomHeight, Vector2 doorSize, bool addDoor, bool makeStatic = true)
        {
            Setup(parent, partName, size);

            Vector2 bottomSize = new Vector2((size.x - doorSize.x) / 2, s_defaultBottomHeight);
            Vector2 midSize    = new Vector2((size.x - doorSize.x) / 2, doorSize.y - 1);
            Vector2 topSize    = new Vector2(size.x, size.y - doorSize.y);

            RoomPart leftBottomWall  = Instantiate(m_bottomWall);
            RoomPart rightBottomWall = Instantiate(m_bottomWall);
            RoomPart leftMidWall     = Instantiate(m_topWall);
            RoomPart rightMidWall    = Instantiate(m_topWall);
            RoomPart topWall         = Instantiate(m_topWall);

            leftBottomWall.Configure(transform, name + "_lb", bottomSize, makeStatic);
            rightBottomWall.Configure(transform, name + "_rb", bottomSize, makeStatic);
            leftMidWall.Configure(transform, name + "_lm", midSize, makeStatic);
            rightMidWall.Configure(transform, name + "_rm", midSize, makeStatic);
            topWall.Configure(transform, name + "_top", topSize, makeStatic);

            leftBottomWall.transform.localPosition  = new Vector3((m_size.x + doorSize.x) / 4, 0, 0);
            rightBottomWall.transform.localPosition = new Vector3(-(m_size.x + doorSize.x) / 4, 0, 0);
            leftMidWall.transform.localPosition     = new Vector3((m_size.x + doorSize.x) / 4, bottomHeight, 0);
            rightMidWall.transform.localPosition    = new Vector3(-(m_size.x + doorSize.x) / 4, bottomHeight, 0);
            topWall.transform.localPosition         = new Vector3(0, doorSize.y, 0);

            if (addDoor)
            {
                DoorPart door = Instantiate(m_doorPart);
                door.Configure(transform, "Door", doorSize, makeStatic);
                door.transform.localPosition = Vector3.zero;
            }

            gameObject.isStatic = makeStatic;
        }
Пример #3
0
    virtual protected void ConfigureCeiling()
    {
        RoomParts.RoomPart ceiling = Instantiate(skin.ceiling);

        Vector2 ceilingSize = new Vector2(m_size.x, m_size.z);

        ceiling.Configure(m_roomStructure, "Ceiling", ceilingSize);

        ceiling.transform.localPosition = new Vector3(0, m_size.y, 0);
    }
Пример #4
0
    virtual protected void ConfigureFloor()
    {
        RoomParts.RoomPart floor = Instantiate(m_skin.floor);

        Vector2 floorSize = new Vector2(m_size.x, m_size.z);

        floor.Configure(m_roomStructure, "Floor", floorSize);

        floor.transform.localPosition = new Vector3(0, 0, 0);
    }
Пример #5
0
        public virtual void Configure(Transform parent, string partName, Vector3 size, bool makeStatic = true)
        {
            Setup(parent, partName, size);

            RoomPart pitBottom = Instantiate(m_pitBottom);

            pitBottom.Configure(transform, partName, m_size, makeStatic);
            pitBottom.transform.localPosition = Vector3.down * m_depth;

            ConfigurePitWalls();
        }
Пример #6
0
        virtual protected void ConfigurePitWall(Transform pitStage, Room.Direction direction)
        {
            Vector3 directionVector = Room.DirectionToVector(direction);
            float   width           = Room.DirectionScale(direction, new Vector3(m_size.x, 1, m_size.y)).magnitude;
            Vector2 wallSize        = new Vector2(width, 1);
            string  wallName        = string.Format("Wall_{0}", direction);

            RoomPart wall = Instantiate(m_pitWall);

            wall.Configure(pitStage, wallName, wallSize);

            wall.transform.localPosition = Vector3.Scale(new Vector3(m_size.x, 1, m_size.y), directionVector) / 2;
            wall.transform.Rotate(Vector3.up, Room.DirectionAngle(direction) - 90, Space.World);
        }
Пример #7
0
        public virtual void Configure(Transform parent, string partName, Vector2 size, float bottomHeight, bool makeStatic = true)
        {
            Setup(parent, partName, size);

            RoomPart bottomWall = Instantiate(m_bottomWall);
            RoomPart topWall    = Instantiate(m_topWall);

            Vector2 bottomSize = new Vector2(m_size.x, bottomHeight);
            Vector2 topSize    = m_size + Vector2.down * bottomHeight;

            bottomWall.Configure(transform, name + "_bottom", bottomSize, makeStatic);
            topWall.Configure(transform, name + "_top", topSize, makeStatic);

            bottomWall.transform.localPosition = Vector3.zero;
            topWall.transform.localPosition    = Vector3.up * bottomHeight;

            gameObject.isStatic = makeStatic;
        }