Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (activator.IsInOppositeDirection()) // Based on the whether the camera is pointing in the opposite direction of the target, choose the preferred arrowPointer behaviour
        {
            arrowPointer.PointHorizontalTowards(activator.GetPointingTarget());
        }
        else
        {
            arrowPointer.PointTowards(activator.GetPointingTarget());
        }

        if (activator.ShouldActivate()) // Start
        {
            if (!animator.IsActivated())
            {
                animator.Activate(arrowPointer.GetGameObject());
            }
        }
        else
        {
            if (animator.IsActivated())
            {
                animator.Deactivate(arrowPointer.GetGameObject());
            }
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (activator.ShouldActivate())  // Check if the arrow should be activated.
        {
            if (!animator.IsActivated()) // If the arrow should be activate, check if the animator is active as well.
            {
                animator.Activate(arrowPointer.GetGameObject());
            }

            if (activator.IsInOppositeDirection()) // Determine how the arrowPointer should point the arrow based on the if the camera is pointing in the opposite direction of the target.
            {
                arrowPointer.PointHorizontalTowards(activator.GetPointingTarget());
            }
            else
            {
                arrowPointer.PointTowards(activator.GetPointingTarget());
            }
        }
        else
        {
            if (animator.IsActivated()) // If the activator should not be active, deactivate the animator if it is set to active.
            {
                animator.Deactivate(arrowPointer.GetGameObject());
            }
        }
    }