示例#1
0
    void Start()
    {
        BuildMesh();
        var mainCam = GameObject.FindWithTag("MainCamera");

        pathSelection = mainCam.GetComponent <PathSelection>();
        nodes         = mainCam.GetComponent <Nodes>();
        rend          = GetComponent <MeshRenderer>();
    }
        private void edit_Click(object sender, EventArgs e)
        {
            UrlInput.Show();

            var uri   = new UriBuilder(_webViewForm.Uri);
            var query = HttpUtility.ParseQueryString(_webViewForm.Uri.Query);

            query.Remove("ClientId");
            uri.Query = query.ToString();

            UrlInput.Text = uri.ToString();

            PathSelection.Hide();
        }
示例#3
0
    public void MovePoint(int i, Vector3 pos, PathSelection selection)
    {
        Vector3 deltaMove = pos - points[i];

        if (i % 3 == 0 || !autoSetControlPoints)
        {
            points[i] = pos;

            if (autoSetControlPoints)
            {
                AutoSetAllAffectedControlPoints(i);
            }
            else
            {
                if (i % 3 == 0)
                {
                    if (i + 1 < points.Count || isClosed)
                    {
                        points[LoopIndex(i + 1)] += deltaMove;
                    }
                    if (i - 1 >= 0 || isClosed)
                    {
                        points[LoopIndex(i - 1)] += deltaMove;
                    }
                }
                else
                {
                    if (selection != PathSelection.Free)
                    {
                        bool isNextPointAnchor         = (i + 1) % 3 == 0;
                        int  correspondingControlIndex = isNextPointAnchor?i + 2:i - 2;
                        int  anchorIndex = isNextPointAnchor?i + 1:i - 1;

                        if (correspondingControlIndex >= 0 && correspondingControlIndex < points.Count || isClosed)
                        {
                            int     indexToMirror = (selection == PathSelection.Auto) ? i : correspondingControlIndex;
                            float   dst           = (points[LoopIndex(anchorIndex)] - points[LoopIndex(indexToMirror)]).magnitude;
                            Vector3 dir           = (points[LoopIndex(anchorIndex)] - pos).normalized;
                            points[LoopIndex(correspondingControlIndex)] = points[LoopIndex(anchorIndex)] + dir * dst;
                        }
                    }
                }
            }
        }
    }
示例#4
0
    void Start()
    {
        measure        = GetComponent <PathMeasurement>();
        nodes          = GetComponent <Nodes>();
        pathSelection  = GetComponent <PathSelection>();
        render         = GetComponent <RenderPaths>();
        cam            = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();
        tutorialText   = GameObject.FindWithTag("TutorialText").GetComponent <Text>();
        nextButton     = GameObject.FindWithTag("NextButton").GetComponent <Button>();
        nextButtonText = GameObject.FindWithTag("NextButtonText").GetComponent <Text>();
        timer          = GameObject.FindWithTag("TimerCircle");
        scoreText      = GameObject.FindWithTag("ScoreText").GetComponent <Text>();
        healthText     = GameObject.FindWithTag("HealthText").GetComponent <Text>();
        undoButton     = GameObject.FindWithTag("UndoButton").GetComponent <Button>();
        skipButton     = GameObject.FindWithTag("SkipButton").GetComponent <Button>();

        RestartGame();
        CreateTutorial();
    }
示例#5
0
    void Awake()
    {
        var overallPathDrawer = Instantiate(Drawer);

        overallPath           = overallPathDrawer.GetComponent <LineDrawer>();
        overallPath.Coloring  = OverallColoring;
        overallPath.LineWidth = 0.2f;
        var selectedPathDrawer = Instantiate(Drawer);

        selectedPath           = selectedPathDrawer.GetComponent <LineDrawer>();
        selectedPath.Coloring  = SelectedPathColoring;
        selectedPath.LineWidth = 0.2f;
        var optimalDrawer = Instantiate(Drawer);

        optimalPath           = optimalDrawer.GetComponent <LineDrawer>();
        optimalPath.Coloring  = OptimalColoring;
        optimalPath.LineWidth = 0.2f;

        nodes         = GetComponent <Nodes>();
        pathSelection = GetComponent <PathSelection>();
        measure       = GetComponent <PathMeasurement>();
    }