Example #1
0
    void AddWaypoint()
    {
        Vector3 waypointPosition = rightPinchDetector.position;

        if (waypoints == null)
        {
            waypoints = new List <GameObject>();
        }
        GameObject waypoint = (GameObject)Instantiate(waypointIndicatorPrefab, waypointPosition, Quaternion.identity);

        Instantiate(waypointAddedPrefab, waypointPosition, Quaternion.identity);
        waypoints.Add(waypoint);
        EventManager.TriggerEvent(EventName.WaypointAdded);
        pathLineRenderer.SetVertexCount(waypoints.Count);
        pathLineRenderer.SetPosition(waypoints.Count - 1, waypointPosition);
        readyToSetWaypointToggle = false;
        if (dynamicObject != null)
        {
            dynamicObject.AddWaypoint(waypoint);
        }
        photonView.RPC("AddRemoteWaypoint", PhotonTargets.OthersBuffered, waypointPosition);
    }