Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        levelCompleteText.enabled = false;
        jsonFilePath = Path.Combine(Application.streamingAssetsPath, Configurations.jsonFilename);

        /*
         * saveFilePath = Path.Combine(Application.persistentDataPath, "game.dat");
         *
         * //Get the id
         * BinaryFormatter formatter = new BinaryFormatter();
         * FileStream stream = File.Open(saveFilePath, FileMode.Open);
         * gameState = formatter.Deserialize(stream) as Dictionary<string, object>;
         * stream.Close();
         * id = (int)gameState["current room id"];
         */

        id = DataUtil.GetCurrentRoomId();

        height = new int[BlockBuilderConfigs.gridSize.x, BlockBuilderConfigs.gridSize.z];
        ParseJson(jsonFilePath, height, id);
        Dictionary <IntVector3, bool> targetBlock = To3DMapping(height);

        targetTopView   = ThreeView.GetTopView(targetBlock);
        targetFrontView = ThreeView.GetFrontView(targetBlock);
        targetRightView = ThreeView.GetRightView(targetBlock);

        targetTopViewPanel.GetComponent <ViewPanel>().DrawView(targetTopView);
        targetFrontViewPanel.GetComponent <ViewPanel>().DrawView(targetFrontView);
        targetRightViewPanel.GetComponent <ViewPanel>().DrawView(targetRightView);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //TODO
        //This should be somewhere else
        int[,] height = new int[Configuration.gridSize.x, Configuration.gridSize.z];
        ParseJson(jsonFilePath, height);
        Dictionary <IntVector3, bool> targetBlock = To3DMapping(height);

        targetTopView   = ThreeView.GetTopView(targetBlock);
        targetFrontView = ThreeView.GetFrontView(targetBlock);
        targetRightView = ThreeView.GetRightView(targetBlock);

        targetTopViewPanel.GetComponent <ViewPanel>().DrawView(targetTopView);
        targetFrontViewPanel.GetComponent <ViewPanel>().DrawView(targetFrontView);
        targetRightViewPanel.GetComponent <ViewPanel>().DrawView(targetRightView);
    }
Ejemplo n.º 3
0
    public void DrawMultiView(BaseGridCell[,] cells)
    {
        Dictionary <IntVector3, bool> cubes = To3DMapping(To2DMapping(cells));
        bool isTopViewCorrect, isFrontViewCorrect, isRightViewCorrect;

        Dictionary <Segment, LineType> topView = ThreeView.GetTopView(cubes);

        currentTopViewPanel.GetComponent <ViewPanel>().DrawView(topView);
        isTopViewCorrect = CompareCurrentAndTargetView(topView, targetTopView);
        targetTopViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(isTopViewCorrect);

        Dictionary <Segment, LineType> frontView = ThreeView.GetFrontView(cubes);

        currentFrontViewPanel.GetComponent <ViewPanel>().DrawView(frontView);
        isFrontViewCorrect = CompareCurrentAndTargetView(frontView, targetFrontView);
        targetFrontViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(isFrontViewCorrect);

        Dictionary <Segment, LineType> rightView = ThreeView.GetRightView(cubes);

        currentRightViewPanel.GetComponent <ViewPanel>().DrawView(rightView);
        isRightViewCorrect = CompareCurrentAndTargetView(rightView, targetRightView);
        targetRightViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(isRightViewCorrect);

        if (isTopViewCorrect && isFrontViewCorrect && isRightViewCorrect)
        {
            BlockBuilderManager.OnComplete();
            levelCompleteText.enabled = true;
            //TODO
            //Unlock this room!
            //To unlock this room, we only need to store this id in the savefile
            DataUtil.UnlockCurrentRoom();

            /*((List<int>) gameState["unlocked rooms"]).Add(id);
             * FileStream stream = File.Create(saveFilePath);
             * BinaryFormatter formatter = new BinaryFormatter();
             * formatter.Serialize(stream, gameState);
             * stream.Close();*/
        }
    }
Ejemplo n.º 4
0
    public void DrawMultiView(BaseGridCell[,] cells)
    {
        Dictionary <IntVector3, bool> cubes = To3DMapping(To2DMapping(cells));
        bool flag;

        Dictionary <Segment, LineType> topView = ThreeView.GetTopView(cubes);

        currentTopViewPanel.GetComponent <ViewPanel>().DrawView(topView);
        flag = CompareCurrentAndTargetView(topView, targetTopView);
        targetTopViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(flag);

        Dictionary <Segment, LineType> frontView = ThreeView.GetFrontView(cubes);

        currentFrontViewPanel.GetComponent <ViewPanel>().DrawView(frontView);
        flag = CompareCurrentAndTargetView(frontView, targetFrontView);
        targetFrontViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(flag);

        Dictionary <Segment, LineType> rightView = ThreeView.GetRightView(cubes);

        currentRightViewPanel.GetComponent <ViewPanel>().DrawView(rightView);
        flag = CompareCurrentAndTargetView(rightView, targetRightView);
        targetRightViewPanel.GetComponent <ViewPanel>().ChangeColorOnCompare(flag);
    }