Ejemplo n.º 1
0
        void CheckIfRacism(Rigidbody2D r)
        {
            if (Human.All.Count < 6 || Human.All.Count > 40 || Achievements.achievementDic["Racism"].isDone)
            {
                return;
            }

            float differentRacesMinAngle = Mathf.Infinity;
            float sameRaceMaxAngle       = 0;

            foreach (Human h1 in Human.All)
            {
                if (h1.race == Human.Race.Alien)
                {
                    continue;
                }
                foreach (Human h2 in Human.All)
                {
                    if (h2.race == Human.Race.Alien)
                    {
                        continue;
                    }
                    float angle = Gravity.Angle(h1.transform.position, h2.transform.position);
                    if (h1.race != h2.race)
                    {
                        if (angle < differentRacesMinAngle)
                        {
                            differentRacesMinAngle = angle;
                        }
                    }
                    else
                    {
                        if (angle > sameRaceMaxAngle)
                        {
                            sameRaceMaxAngle = angle;
                        }
                    }
                }
            }

            if (differentRacesMinAngle < 360 && differentRacesMinAngle * 2 > sameRaceMaxAngle)
            {
                Achievements.Racism();
            }
        }