public void RemoveTargetFromList(Delivery_End _target)
    {
        // Get the index of the target
        int targetIndex = m_possibleTargets.IndexOf(_target);

        // Remove the target from the list
        m_possibleTargets.Remove(_target);

        // If the target is the active one, we need to switch to a different one
        // Otherwise, we can stay focused on the same one
        if (_target == m_currentTarget)
        {
            // If there is another target we can instantly jump to, do that. Otherwise, change the target to null
            if (m_possibleTargets.Count > 0)
            {
                // Go back to the previous target
                PrevTarget();
            }
            else
            {
                // There is no new target
                CurrentTarget = null;
            }
        }

        // Invoke the event since the list changed
        OnTargetListChanged.Invoke(m_possibleTargets.Count);

        // We completed another delivery so increase the counter and invoke the UI update as well
        m_numComplete++;
        OnCounterChanged.Invoke(m_numComplete, m_numTotal);
    }
Example #2
0
    public void OnNewTargetZone(Delivery_End _newTarget)
    {
        // Toggle the blocker image to black out the viewer or keep it visible, depending on if there is a target or not
        m_camViewBlocker.SetActive(_newTarget == null);

        // If the new zone is actually null, we should simply set the image to black and update the label to say so
        // Otherwise, we need to show the zone camera's view instead
        if (_newTarget == null)
        {
            // Change the label to indicate that there is no target
            m_animZoneLabel.text = "No Deliveries";
        }
        else
        {
            // Get the zone's camera
            Camera zoneCam = _newTarget.m_zoneCam;

            // Force the camera to render one frame so that it updates the render texture
            // This can be done even if the camera is disabled
            zoneCam.Render();

            // Change the label to indicate there is a delivery dropoff available
            m_animZoneLabel.text = "Dropoff Point";
        }
    }
    public void AddTargetToList(Delivery_End _target)
    {
        // Add the target to the list
        m_possibleTargets.Add(_target);

        // This new target should always become the immediate focus
        CurrentTarget = _target;

        // Invoke the event since the list changed
        OnTargetListChanged.Invoke(m_possibleTargets.Count);
    }