예제 #1
0
        public AresMissileActor(RadarViewTranslator view_translator, AresMissileSprite sprite)
            : base(view_translator, sprite)
        {
            InitializeComponent();

            _ares_missile_sprite = sprite;
            _ares_missile_sprite.NowFallingStateChange += new AresMissileSprite.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");
        }
예제 #2
0
        void execFireMissleAtTrackedTarget(KeeperTime ktime, XFireMissleTrackedPilotCmd command)
        {
            // If the command is active, and we have a valid bogey ...
            if (command.tracked_target_id != 0)
            {
                // Make a new sprite.
                AresMissileSprite sprite = new AresMissileSprite(ktime, _controller_request,
                                                                 Position, Heading, Speed * 4.0, 0.0, _controller_request.getSprite(command.tracked_target_id));

                // Tell the controller to add it to the game.
                _controller_request.AddSprite(ktime, sprite);
            }
        }
예제 #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);
            }
        }