Exemplo n.º 1
0
        /// <summary>
        /// Drop a new sprite into the game.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="heading"></param>
        /// <param name="speed"></param>
        void BasicBogey_Drop(KeeperTime ktime, Vector position, double heading, double speed)
        {
            //////////////////////////////////
            // Make a new sprite.
            BasicBogeySprite sprite = new BasicBogeySprite(ktime, (IPilotControllerRequest)this,
                                                           position, heading, speed);

            AddSprite(ktime, sprite); // Add a sprite to the controller.
        }
Exemplo n.º 2
0
        public BasicBogeyActor(RadarViewTranslator view_translator, BasicBogeySprite sprite)
            : base(view_translator, sprite)
        {
            InitializeComponent();

            _basic_boey_sprite = sprite;

            _basic_boey_sprite.NowFallingStateChange += new BasicBogeySprite.StateChangeHandler(_Sprite_NowFalling);

            // Find the story boards in the xaml, so we can start/stop the animations when we want to.
            _spinning_falling_death_story = (Storyboard)TryFindResource("SpinningFallingDeathStoryKey");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Callback handler for when the controller adds a sprited.
        /// </summary>
        protected void Controller_AddedSpriteHandler(object sender, AddSpriteArgs e)
        {
            if (e.sprite is AresMissileSprite)
            {
                AresMissileSprite sprite = e.sprite as AresMissileSprite;
                // Make a new actor.
                AresMissileActor actor = new AresMissileActor(_view_translator, sprite);
                actor.Moved   += Actor_MovedHandler;
                actor.Removed += Actor_RemovedHandler;

                _bogey_actors.Add(actor);                       // Add the actor to the list of bogeys the stage is tracking.

                RadarTargetInsertionCanvas.Children.Add(actor); // Add the actor to the stage.
                actor.Visibility = Visibility.Visible;          // Make the actor visible in the stage.
            }
            else if (e.sprite is BasicBogeySprite)
            {
                BasicBogeySprite sprite = e.sprite as BasicBogeySprite;
                // Make a new actor.
                BasicBogeyActor actor = new BasicBogeyActor(_view_translator, sprite);
                actor.Moved   += Actor_MovedHandler;
                actor.Removed += Actor_RemovedHandler;

                _bogey_actors.Add(actor);                       // Add the actor to the list of bogeys the stage is tracking.

                RadarTargetInsertionCanvas.Children.Add(actor); // Add the actor to the stage.
                actor.Visibility = Visibility.Visible;          // Make the actor visible in the stage.
            }
            else if (e.sprite is PrimePilotSprite)
            {
                PrimePilotSprite sprite = e.sprite as PrimePilotSprite;
                _prime_pilot_sprite = sprite;

                _prime_pilot_sprite.DebugCommandsOn = true; // Turn on extended debug commands.

                // Attach observer/callbacks we need from sprite.
                sprite.Moved   += new MovedHandler(PrimePilotSprite_MovedHandler);
                sprite.Removed += new RemoveHandler(PrimePilotSprite_RemovedHandler);
            }
        }