Пример #1
0
 public void UpdateShownPieces(GridSlice gridSlice)
 {
     foreach (PiecePresenter piece in gamePieces)
     {
         placeItemFor(piece, gridSlice);
     }
 }
 public TextureToPack(UnityEngine.Texture2D preLoadedTexture, string id, GridSlice sliceParams = null)
 {
     this.file             = string.Empty;
     this.id               = id;
     this.sliceParams      = sliceParams;
     this.preLoadedTexture = preLoadedTexture;
 }
 public TextureToPack(string file, string id, GridSlice sliceParams = null)
 {
     this.file             = file;
     this.id               = id;
     this.sliceParams      = sliceParams;
     this.preLoadedTexture = null;
 }
Пример #4
0
    public void placeItemFor(PiecePresenter piece, GridSlice gridSlice)
    {
        switch (gridSlice.worldOrientation)
        {
        case WorldOrientation.xyz:
            if (piece.hyperPosition.w != gridSlice.unseenDepth)
            {
                piece.SetSeen(false);
                return;
            }
            piece.SetSeen(true);
            placeSomething(piece.gameObject, piece.hyperPosition.x, piece.hyperPosition.y, piece.hyperPosition.z);
            break;

        case WorldOrientation.xyw:
            if (piece.hyperPosition.z != gridSlice.unseenDepth)
            {
                piece.SetSeen(false);
                return;
            }
            piece.SetSeen(true);
            placeSomething(piece.gameObject, piece.hyperPosition.x, piece.hyperPosition.y, piece.hyperPosition.w);
            break;

        case WorldOrientation.xzw:
            if (piece.hyperPosition.y != gridSlice.unseenDepth)
            {
                piece.SetSeen(false);
                return;
            }
            piece.SetSeen(true);
            placeSomething(piece.gameObject, piece.hyperPosition.x, piece.hyperPosition.w, piece.hyperPosition.z);
            break;

        case WorldOrientation.yzw:
            if (piece.hyperPosition.x != gridSlice.unseenDepth)
            {
                piece.SetSeen(false);
                return;
            }
            piece.SetSeen(true);
            placeSomething(piece.gameObject, piece.hyperPosition.w, piece.hyperPosition.y, piece.hyperPosition.z);
            break;
        }
    }
Пример #5
0
 public void updateGrid(HyperGrid hyperGrid, GridSlice slice)
 {
     if (blocks == null)
     {
         createGrid();
     }
     for (int x = 0; x < Constants.sizeX; x++)
     {
         for (int y = 0; y < Constants.sizeY; y++)
         {
             for (int z = 0; z < Constants.sizeZ; z++)
             {
                 GameObject block = blocks[x, y, z];
                 block.SetActive(checkBlockedForDirection(hyperGrid, slice.worldOrientation, x, y, z, slice.unseenDepth));
             }
         }
     }
 }
Пример #6
0
    public void StartLevel(Level level)
    {
        player = new Player(level.playerStart, HyperDirection.normal);

        goalPresenter.hyperPosition = level.goalPosition;
        gridPresenter.addPiece(goalPresenter);
        game = new Game(player, level.hyperGrid, goalPresenter.hyperPosition);



        GridSlice gridSlice = playerPresenter.orientationForDirection(player.direction, player.position);

        worldOrientationText.text = stringForOrientation(gridSlice.worldOrientation);

        gridPresenter.updateGrid(level.hyperGrid, playerPresenter.orientationForDirection(player.direction, player.position));
        gridPresenter.placeSomething(playerPresenter.gameObject, player.position.x, player.position.y, player.position.z);
        gridPresenter.UpdateShownPieces(playerPresenter.orientationForDirection(player.direction, player.position));
        updateScreen(gridSlice.worldOrientation);
    }