// process click event
    private void PlacePointClickRecieved(EventParam positionParam)
    {
        if (clickCount == 0)
        {
            angleInstance = new PointsAngleClass();
            instanceList.Add(angleInstance);
        }

        if (clickCount < 3)
        {
            clonePoint = Instantiate(refPoint, cloneParent);
            clonePoint.SetActive(true);
            clonePoint.transform.position = positionParam.getPointParam();

            angleInstance.AddElement(clonePoint);

            anglePositions[clickCount] = clonePoint.transform.localPosition;

            clickCount += 1;
        }

        if (clickCount == 3)
        {
            angleLine = Instantiate(refLine, cloneParent);
            angleLine.SetActive(true);
            angleLine.name = "newLine";
            angleLine.GetComponent <LineRenderer>().positionCount = 3;
            angleLine.GetComponent <LineRenderer>().SetPositions(anglePositions);

            angleInstance.AddLine(angleLine);
        }
    }
    // process click event
    public void PlacePlaneClickRecieved(EventParam positionParam)
    {
        if (clickCount == 0)
        {
            planeDistanceInstance = new PlaneDistanceClass();
            instanceList.Add(planeDistanceInstance);
        }

        if (clickCount < 2)
        {
            clonePlane = Instantiate(refPlane, cloneParent);
            clonePlane.SetActive(true);
            clonePlane.transform.position = positionParam.getPointParam();

            if (clickCount == 1)
            {
                normalLine = Instantiate(refLine, clonePlane.transform);
                normalLine.SetActive(true);
                normalLine.transform.localPosition = Vector3.zero;
                normalLine.transform.eulerAngles   = Vector3.zero;
                normalLine.name = "Arrow";
            }

            planeDistanceInstance.AddElement(clonePlane);
        }

        clickCount += 1;
    }
Exemplo n.º 3
0
    // process click event
    private void PlacePointClickRecieved(EventParam positionParam)
    {
        if (clickCount == 0)
        {
            // this event is produced for the first time
            pathInstance  = new Path();
            pathPositions = new List <Vector3>();

            instanceList.Add(pathInstance);
        }

        if (clickCount == 1)
        {
            // instanciate a line and add it to the path instance
            pathLine = Instantiate(refLine, cloneParent);
            pathLine.SetActive(true);
            pathLine.name = "newLine";

            pathInstance.AddLine(pathLine);
        }

        // duplicate the reference Point game object and set its position
        clonePoint = Instantiate(refPoint, cloneParent);
        clonePoint.SetActive(true);
        clonePoint.transform.position = positionParam.getPointParam();

        // add the new Point to the pathInstance list
        pathInstance.AddElement(clonePoint);

        // add the point to the line renderer
        pathPositions.Add(clonePoint.transform.localPosition);

        if (clickCount > 0)
        {
            if (clickCount > 1)
            {
                pathLine.GetComponent <LineRenderer>().positionCount += 1;
                pathLine.GetComponent <LineRenderer>().SetPosition(pathLine.GetComponent <LineRenderer>().positionCount - 1, pathPositions[pathLine.GetComponent <LineRenderer>().positionCount - 1]);
            }
            //pathLine.GetComponent<LineRenderer>().SetPositions(pathPositions.ToArray());
        }

        // update the number of click eveents recieved
        clickCount += 1;
    }
    // process click event
    void PlaceWulffElementClickRecieved(EventParam positionParam)
    {
        if (clickCount == 0)
        {
            wulffInstance = new WulffClass();

            cloneElipse = Instantiate(refElipse, cloneParent);
            cloneElipse.SetActive(true);
            cloneElipse.transform.position = positionParam.getPointParam();

            wulffInstance.AddElement(cloneElipse);
        }
        else if (clickCount == 1)
        {
            cloneElipse.tag = "Untagged";

            DrawWulffSphere(cloneElipse.transform.localPosition);
            wulffSphere.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
            wulffInstance.AddElement(wulffSphere);
        }
        clickCount += 1;
    }
    public void PlaceMarkerClickRecieved(EventParam pointParam)
    {
        if (newMarkerAllowed == true)
        {
            if (clickCount == 0)
            {
                markerInstance = new Marker();
                //saveInstance.AddInstanceToSave(markerInstance);
            }

            cloneMarker = Instantiate(refMarker, cloneParent);
            cloneMarker.SetActive(true);
            cloneMarker.transform.position = pointParam.getPointParam();

            markerInstance.AddElement(cloneMarker);
            instancesList.Add(markerInstance);
            clickCount += 1;

            // block new marker creation when setting current parameters
            newMarkerAllowed = false;
            EventManager.TriggerEvent("ShowHideMarkerEditorInterface", null);
        }
    }
 void PlaceSpawnMarker(EventParam positionParam)
 {
     // activate and place the spawn marker on the mini terrain
     lobbyEnvironment.transform.GetChild(3).position = positionParam.getPointParam();
     lobbyEnvironment.transform.GetChild(3).gameObject.SetActive(true);
 }