示例#1
0
    public virtual void SetLocKRoom(Direct[] directs)
    {
        LockRooms = new List <LockRoom>();
        for (int i = 0; i < directs.Length; i++)
        {
            LockRoom a = null;
            switch (directs[i])
            {
            case Direct.Left:
                a = Instantiate(DataMap.GetLockRoomPrefab(LockRoomDatas.Direct.Vertical), transform);
                a.transform.position = (Vector2)Data.GetPositionOutSide(Direct.Left);
                break;

            case Direct.Right:
                a = Instantiate(DataMap.GetLockRoomPrefab(LockRoomDatas.Direct.Vertical), transform);
                a.transform.position = (Vector2)Data.GetPositionOutSide(Direct.Right) + Vector2.left;
                break;

            case Direct.Up:
                a = Instantiate(DataMap.GetLockRoomPrefab(LockRoomDatas.Direct.Horizontal), transform);
                a.transform.position = (Vector2)Data.GetPositionOutSide(Direct.Up) + Vector2.down;
                break;

            case Direct.Down:
                a = Instantiate(DataMap.GetLockRoomPrefab(LockRoomDatas.Direct.Horizontal), transform);
                a.transform.position = (Vector2)Data.GetPositionOutSide(Direct.Down);
                break;
            }
            if (a != null)
            {
                LockRooms.Add(a);
            }
        }
    }