I really need alot of help with finalizing this code including degrees and rotation. Unity 2019.3.13f

In my previous threads I have discussed with people on how I can make directional sprites but nothing works except for this code

int GetAngleIndex()
 {
            var dir = GetComponent<Camera>().transform.position - transform.parent.forward;
                var enemyAngle = Mathf.Atan2(dir.z, dir.x) * Mathf.Rad2Deg;
                if (enemyAngle < 0.0f)
                    enemyAngle += 360;
                Debug.Log("Angle from the player is: " + enemyAngle);
                if (enemyAngle >= 292.5f && enemyAngle < 337.5f)
                    zom.SetFloat("rotation",0);
                else if (enemyAngle >= 22.5f && enemyAngle < 67.5f)
                    zom.SetFloat("rotation",0);
                else if (enemyAngle >= 67.5f && enemyAngle < 112.5f)
                    zom.SetFloat("rotation",);
                else if (enemyAngle >= 112.5f && enemyAngle < 157.5f)
                    return 4;
                else if (enemyAngle >= 157.5f && enemyAngle < 202.5f)
                    return 5;
                else if (enemyAngle >= 202.5f && enemyAngle < 247.5f)
                    return 6;
                else if (enemyAngle >= 247.5f && enemyAngle < 292.5f)
                    return 7;
                else if (enemyAngle >= 337.5f || enemyAngle < 22.5f)
                    return 1;
                else return 0;
        }

It hasn’t been quite modified yet for my uses. The first problem is the rotation numbers only appear as 179 to -179 I assume there is an invisible 180 on both sides of the spectrum.
The animator float I am using is one that will be used to make a spectrum of numbers that are 1 to 4 each one triggering a directional idle animation that is like that of doom’s. I DO NOT WANT A SHADER SOLUTION
The enemy angle code won’t work since like doom the sprites are not independent of rotation there rotation numbers are the same as the player’s. This is because my Doom style I want has to of course be like doom so all of the sprites are bill boards.

Or maybe this code does but in my eyes it just won’t get the numbers right because I don’t think the code will convert negative numbers like -160 to 340.

I have been stumped on this for weeks If anyone can just please help and stay here to help me. The code that this thing came from was from another post I have. It looked promising so I wanted to modify it to my needs but sadly the person that made it thought they tackled the problem and were done but not only do the numbers and the if statements need to be modified but get angle index doesn’t even work on the code.

Please help I have been stuck for weeks on this

seems ok, for values close to 180 it may be due to a cast to int, but since the result of atan2 is a float it may be ok, but use “ennemyAngle += 360f;” instead (better use csharp to avoid those problems)

for the rest, it seems ok, despite having provided unfinished code with nothing aside. And if you do not know english very well, please use shorter sentences because the paragraph downside is basically unreadable.
And even if I understand what you wanna since I have absolutely no Idea of your environment, I do not have any idea about whats going wrong, And you seem to have not a really good understanding of how things work within unity so no one can answer and even if they do, it may get back on very basic problems cause by your lack of knowledge which may be very simple for them.

I advise you to read what you wrote after having written it (personally I do sometimes, not here) because you may understand why it’s a problem.

Sorry to see you having problems, but devs in needs of answers with clear things related to how unity works are crawling below other questions which cannot be answer.

I wanna help but I cannot, and probably noone will while other in need may be help quite quickly.