public override void Render()
        {
            base.Render();

            const int subsegmentCount = connectionLineSegments * connectionLineSubSegments;

            for (int i = 0; i < companions.Length - 1; i++)
            {
                if (activeCompanions.Count == 0 || !activeCompanions.Contains(companions[i]) || !activeCompanions.Contains(companions[i + 1]))
                {
                    continue;
                }

                Vector2 direction  = companions[i + 1].Position - companions[i].Position;
                bool    bothActive = companions[i + 1].Activated && companions[i].Activated;
                float   lineLength = direction.Length();
                direction.Normalize();
                Vector2 perpendicular = direction.Rotate((float)(Math.PI / 2));

                for (int j = 1; j < subsegmentCount; j++)
                {
                    float amplitude = (float)Math.Sin(connectionLineOffset + 2.0f * Math.PI / connectionLineSubSegments * (j % connectionLineSubSegments)) * connectionLineAmplitude;
                    float longitude = lineLength / subsegmentCount * j;

                    Vector2 pos = companions[i].Position + direction * longitude + perpendicular * amplitude;

                    if (killCircle != null && companions[i] == nearestCompanions[0] && companions[i + 1] == nearestCompanions[1] && Collide.CheckPoint(killCircle, pos))
                    {
                        continue;
                    }

                    Draw.Point(pos, bothActive ? Color.Green : requiresDash ? Color.HotPink : Color.LightSteelBlue);
                }
            }
        }
Ejemplo n.º 2
0
 public bool CollidePoint(Vector2 point, Vector2 at)
 {
     return(Collide.CheckPoint(this, point, at));
 }