Exemple #1
0
    private void UpdateSprites()
    {
        currentAimAngle = AimHelper.GetCurrentAimAngle(targetPosition, transform.position);

        if (currentAimAngle != lastAimAngle)
        {
            if (currentAimAngle.y == Enums.Angles.Y.Top)
            {
                mySpriteRenderer.sprite = lookingUpSprite;
            }
            else
            {
                mySpriteRenderer.sprite = lookingDownSprite;
            }

            if (currentAimAngle.x == Enums.Angles.X.Left)
            {
                myGun.SetBehindEntity(true, mySpriteRenderer);
            }
            else
            {
                myGun.SetBehindEntity(false, mySpriteRenderer);
            }

            if ((lastAimAngle == null && currentAimAngle.x == Enums.Angles.X.Left) || (lastAimAngle != null && currentAimAngle.x != lastAimAngle.x))
            {
                Flip();
            }
        }
    }
Exemple #2
0
    private void UpdateSprites()
    {
        if (!isDead)
        {
            currentAimAngle = AimHelper.GetCurrentAimAngle(targetPosition, transform.position);

            if (currentAimAngle != lastAimAngle)
            {
                isLookingUp = currentAimAngle.y == Enums.Angles.Y.Top;

                if ((lastAimAngle == null && currentAimAngle.x == Enums.Angles.X.Left) || (lastAimAngle != null && currentAimAngle.x != lastAimAngle.x))
                {
                    Flip();
                }
            }
        }
    }