Example #1
0
        public override void Update()
        {
            //if the number of swords in trace is 0
            //or the last created sword reach its limit distance
            if (Helper.EuclideanDistance(Position, previousSESpawnPosition) > Parameter.ProjectileKnightTraceDistanceOffset)
            {
                previousSESpawnPosition = Position;

                //a new sword and sfx is appended to the trace
                SpecialEffect sword = SpecialEffectBuilder.KnightProjectileBullet1(Position, CurrentFlipbookRotation);

                swordTrace.Insert(0, sword);

                //Transparency
                initialAlpha = Parameter.ProjectileKnightInitialAlpha;

                foreach (SpecialEffect se in swordTrace)
                {
                    se.Flipbook.Color = FlipbookList[0].Color * initialAlpha;
                    initialAlpha     -= Parameter.ProjectileKnightTraceAlphaDecay + swordTrace.Count * Parameter.ProjectileKnightTraceAlphaDecayFactor;
                }
            }

            base.Update();
        }