void StopCamGLRenderAndPlacingSphere()
 {
     if (cameraScript.selecting)
     {
         Vector3 v1 = selectTipBlock.transform.position;
         ISSCGridPrimitiveShapeUtilities.CreateSphere(core.data, ISSCBGrid.WorldPositionToGridPosition(v1, core.moniter.transform.position), core.currentFillingBlock, radius);
         cameraScript.selecting = false;
         radius = 0;
     }
 }
 void StopCamGLRenderAndPlacingCube()
 {
     if (cameraScript.selecting)
     {
         Vector3         v1           = selectTipBlock.transform.position;
         ISSCBlockVector fromPosition = ISSCBGrid.WorldPositionToGridPosition(v1 + Vector3.one * length, core.moniter.transform.position);
         ISSCBlockVector toPosition   = ISSCBGrid.WorldPositionToGridPosition(v1 - Vector3.one * length, core.moniter.transform.position);
         ISSCGridPrimitiveShapeUtilities.CreateCube(core.data, core.currentFillingBlock, fromPosition, toPosition);
         cameraScript.selecting = false;
         length = 0;
     }
 }
示例#3
0
    public void Submit(string command)
    {
        if (command.StartsWith("select block"))
        {
            string argu = command.Substring(12);
            core.currentFillingBlock = int.Parse(argu);
        }
        else if (command.StartsWith("sb"))
        {
            string argu = command.Substring(2);
            core.currentFillingBlock = int.Parse(argu);
        }
        else if (command.StartsWith("save"))
        {
            string argu = command.Substring(command.IndexOf("\"") + 1, command.LastIndexOf("\"") - command.IndexOf("\"") - 1);
            core.SaveCurrentScene(Application.dataPath + "/Resources/SavedDatas/" + argu);
        }
        else if (command.StartsWith("load"))
        {
            string argu = command.Substring(command.IndexOf("\"") + 1, command.LastIndexOf("\"") - command.IndexOf("\"") - 1);
            core.OpenScene(Application.dataPath + "/Resources/SavedDatas/" + argu);
        }
        else if (command.StartsWith("new"))
        {
            string[] argus = ParseArguments(command);
            int      size  = int.Parse(argus [0]);
            core.NewScene(new ISSCBlockVector(size, size, size), "New Scene");
        }
        else if (command.StartsWith("sphere"))
        {
            string[]        argus        = ParseArguments(command);
            ISSCBlockVector center       = ParseBlockVector(argus [0]);
            int             r            = int.Parse(argus [1]);
            int             fillingBlock = int.Parse(argus [2]);

            ISSCGridPrimitiveShapeUtilities.CreateSphere(core.data, center, fillingBlock, r);
        }
        else if (command.StartsWith("cube"))
        {
            string[]        argus        = ParseArguments(command);
            ISSCBlockVector a            = ParseBlockVector(argus [0]);
            ISSCBlockVector b            = ParseBlockVector(argus [1]);
            int             fillingBlock = int.Parse(argus [2]);

            ISSCGridPrimitiveShapeUtilities.CreateCube(core.data, fillingBlock, a, b);
        }
        else if (command.StartsWith("move"))
        {
            string[]        argus = ParseArguments(command);
            ISSCBlockVector a     = ParseBlockVector(argus [0]);
            ISSCBlockVector b     = ParseBlockVector(argus [1]);
            bool            forceMove;
            switch (argus [2])
            {
            case "true":
                forceMove = true;
                break;

            case "false":
                forceMove = false;
                break;

            default:
                forceMove = true;
                break;
            }

            core.data.MoveBlock(a, b, forceMove);
        }
        else if (command.StartsWith("currentmoveto"))
        {
            string[]        argus = ParseArguments(command);
            ISSCBlockVector a     = ParseBlockVector(argus [0]);
            bool            forceMove;
            switch (argus [1])
            {
            case "true":
                forceMove = true;
                break;

            case "false":
                forceMove = false;
                break;

            default:
                forceMove = true;
                break;
            }
            ISSCBlockVector currentBlock = ISSCBGrid.WorldPositionToGridPosition(core.tipsBlock.transform.position, core.moniter.transform.position);
            core.data.MoveBlock(currentBlock, a, forceMove);
            core.tipsBlock.transform.position = ISSCBGrid.GridPositionToWorldPosition(a, core.moniter.transform.position);
            Debug.Log(ISSCBGrid.GridPositionToWorldPosition(a, core.moniter.transform.position));
        }
    }