Пример #1
0
    public void CheckIf_TurningAnimationIsOn(Vector2 _point0, Vector2 _point3)
    {
        float bottomLimit = _point0.y - 2;
        float topLimit    = _point3.y + 10;

        // If turning animation is off
        if (!turningAnimationIsOn)
        {
            if ((transform.position.y <= bottomLimit) && (transform.position.y > topLimit))
            {
                // Set turning animation as on
                turningAnimationIsOn = true;

                // Fire event: Turning animation is on
                TurningAnimationIsOn?.Invoke();
            }
        }

        // If turning animation is on
        else
        {
            if (transform.position.y <= topLimit)
            {
                // Set turning animation as off
                turningAnimationIsOn = false;

                // Fire event: Turning animation is off
                TurningAnimationIsOff?.Invoke();
            }
        }
    }
Пример #2
0
    public void CheckIf_TurningAnimationIsOn(Vector2 _point3)
    {
        float limit = _point3.y + 10;

        // If turning animation is off
        if (turningAnimationIsOn)
        {
            if (transform.position.y <= limit)
            {
                // Set turning animation as off
                turningAnimationIsOn = false;

                // Fire event: Turning animation is off
                TurningAnimationIsOff?.Invoke();
            }
        }
    }
Пример #3
0
 private void RespondTo_TurningAnimationIsOff_Event()
 {
     // Fire event: Turning animation is off
     TurningAnimationIsOff?.Invoke();
 }