示例#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();
            }
        }
    }
    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();
 }