示例#1
0
 private static void SortSections(AngleSection[] sections)
 {
     for (int i = 0; i < (sections.Length - 1); i++)
     {
         for (int j = i + 1; j < sections.Length; j++)
         {
             if (sections[i].start > sections[j].start)
             {
                 AngleSection section = sections[i];
                 sections[i] = sections[j];
                 sections[j] = section;
             }
         }
     }
 }
示例#2
0
 private int GetSection(AngleSection[] sections, float angle)
 {
     for (int i = 0; i < sections.Length; i++)
     {
         AngleSection section = sections[i];
         if (section.Contain(angle))
         {
             return(i);
         }
     }
     if (!sections[0].Contain(angle - 360f))
     {
         SuperDebug.VeryImportantAssert(false, "failed to get section");
     }
     return(0);
 }
示例#3
0
        private void CheckSections(ref AngleSection[] sections)
        {
            if ((sections == null) || (sections.Length == 0))
            {
                sections = new AngleSection[] { new AngleSection(0f, 360f, 0f) };
            }
            foreach (AngleSection section in sections)
            {
                section.start = RegularAngle(section.start);
                section.end   = RegularAngle(section.end);
                if (section.start > section.end)
                {
                    section.start -= 360f;
                }
            }
            SortSections(sections);
            AngleSection        section2 = null;
            List <AngleSection> list     = new List <AngleSection>();

            foreach (AngleSection section3 in sections)
            {
                if ((section2 != null) && (section3.start > (section2.end + float.Epsilon)))
                {
                    list.Add(new AngleSection(section2.end, section3.start, section3.incidentAngle));
                }
                list.Add(section3);
                section2 = section3;
            }
            float a = RegularAngle(list[0].start);

            if (Mathf.Approximately(a, 0f))
            {
                a = 360f;
            }
            if (a > (section2.end + 0.001f))
            {
                list.Add(new AngleSection(section2.end, a, section2.incidentAngle));
            }
            sections = list.ToArray();
        }
示例#4
0
 private float IncidentAngleBySection()
 {
     this._avatarAngle = this.GetIncidentAngle(this._avatarTrsf, Camera.main.transform.forward);
     if (this._avatarAngle < 0f)
     {
         this._avatarAngle += 360f;
     }
     if (this.isInterpolate)
     {
         this._sectionId = this.GetSection(this.sectionsInterpolate, this._avatarAngle);
         AngleSection section = this.sectionsInterpolate[this._sectionId];
         int          index   = (this._sectionId + 1) % this.sectionsInterpolate.Length;
         float        num3    = this._avatarAngle - section.start;
         if (num3 > 360f)
         {
             num3 -= 360f;
         }
         return(Mathf.LerpAngle(section.incidentAngle, this.sectionsInterpolate[index].incidentAngle, num3 / (section.end - section.start)));
     }
     this._sectionId = this.GetSection(this.sections, this._avatarAngle);
     this._incidentAngleTranistionTarget = this.sections[this._sectionId].incidentAngle;
     return(this.TransitIncidentAngle());
 }