예제 #1
0
파일: Level.cs 프로젝트: Manquia/Sandbox
    void MoveUnsetLine(int recalloffset, SetupInstance.DrawingLine dl)
    {
        //Debug.Log("MoveUnsetLine");
        GameObject line    = dl.go;
        var        rend    = line.GetComponent <LineRenderer>();
        var        ptCount = rend.positionCount;

        rend.SetPosition(ptCount - 1, Camera.main.ScreenToWorldPoint(dl.input.Recall(recalloffset).pos));

        SnapUnsetLine(line);
    }
예제 #2
0
파일: Level.cs 프로젝트: Manquia/Sandbox
    void CancelUnsetLine(SetupInstance.DrawingLine dl, int id)
    {
        Debug.Log("CancelUnsetLine");
        // Record to have the Unset line taken out of our records at the begining of next update
        InputData inData = new InputData(Vector2.zero, InputData.Phase.Canceled, id);

        dl.input.Record(inData);
        if (dl.go != null)
        {
            Destroy(dl.go);
            dl.go = null;
        }
    }
예제 #3
0
파일: Level.cs 프로젝트: Manquia/Sandbox
    // Place line if possible
    void EndUnsetLine(int recalloffset, SetupInstance.DrawingLine dl)
    {
        Debug.Log("EndUnsetLine");
        GameObject unsetLine = dl.go;

        // validate line
        {
            var rend = unsetLine.GetComponent <LineRenderer>();
            var pt0  = rend.GetPosition(0);
            var pt1  = rend.GetPosition(1);

            if ((pt0 - pt1).magnitude < 0.001f) // line does not exist
            {
                Debug.Log("Drawn line unsetLine was malformed, rejecting Set");
                return;
            }
        }

        // Setup line
        LineCommand lc = unsetLine.GetComponent <UnsetLine>().Set(this, LineCommand.Command.Place);

        // Record Place History
        RecordLineCommand(lc);
    }