Beispiel #1
0
        protected override void UpdateSourcePoints(Vector2 position, float rotation)
        {
            SourcePoints.Clear();
            float delta = Util.TwoPI / Count;

            for (int i = 0; i < Count; i++)
            {
                float       currentRotation = Mathf.Deg2Rad * rotation + i * delta;
                SourcePoint sourcePoint     = new SourcePoint(position + Radius * Util.OnUnitCircleRadians(currentRotation),
                                                              ((Normal) ? Mathf.Rad2Deg * currentRotation - 90f : rotation));
                SourcePoints.Add(sourcePoint);
            }
        }
Beispiel #2
0
        protected override void UpdateSourcePoints(Vector2 position, float rotation)
        {
            SourcePoints.Clear();
            int     edge      = 0;
            float   edgeRot   = 90f + rotation;
            float   edgeDelta = 360f / EdgeCount;
            Vector2 current   = position + Size * Util.OnUnitCircle(edgeRot);
            Vector2 next      = position + Size * Util.OnUnitCircle(edgeRot + edgeDelta);

            edgeRot += edgeDelta;
            while (edge <= edgeCount)
            {
                Vector2 diff = (next - current) / (pointsPerEdge);
                float   rot  = rotation;
                switch (type)
                {
                case RotationType.None:
                case RotationType.Radial:
                    break;

                case RotationType.Tangential:
                    rot = edgeRot - 0.5f * edgeDelta;
                    break;

                case RotationType.Normal:
                    rot = edgeRot - 90f - 0.5f * edgeDelta;
                    break;
                }
                for (int i = 0; i < PointsPerEdge; i++)
                {
                    Vector2 currentPos = current + i * diff;
                    if (Type == RotationType.Radial)
                    {
                        rot = DanmakuUtil.AngleBetween2D(position, currentPos);
                    }
                    SourcePoints.Add(new SourcePoint(currentPos, rot));
                }
                edge++;
                edgeRot += edgeDelta;
                current  = next;
                next     = position + Size * Util.OnUnitCircle(edgeRot);
            }
        }