예제 #1
0
        public override void OnLaserbeams(List <Laserbeam> laserbeams)
        {
            HashSet <Laserbeam> needsUpdate = new HashSet <Laserbeam>(reflections.Keys);

            foreach (Laserbeam beam in laserbeams)
            {
                reflect(beam);
                needsUpdate.Remove(beam);
            }

            foreach (Laserbeam beam in needsUpdate)
            {
                Laserbeam target = reflections[beam];

                target.RemoveSelf();
                reflections.Remove(beam);
            }
        }
예제 #2
0
        public override void Update()
        {
            if (isActive())
            {
                if (laserbeam == null && !inStartupAnimation)
                {
                    startupSprite.Play("start", true);
                    startupSprite.Rate    = 1;
                    startupSprite.Visible = true;
                    idleSprite.Visible    = false;

                    inStartupAnimation = true;

                    bloom.Visible = light.Visible = true;
                }
            }
            else
            {
                if (laserbeam != null && !inStartupAnimation)
                {
                    startupSprite.Play("start", true);
                    startupSprite.Rate = -1;
                    startupSprite.SetAnimationFrame(startupSprite.CurrentAnimationTotalFrames - 1);
                    startupSprite.Visible = true;
                    idleSprite.Visible    = false;

                    inStartupAnimation = true;

                    laserbeam.RemoveSelf();
                    laserbeam = null;

                    bloom.Visible = light.Visible = false;
                }
            }

            base.Update();
        }