Exemplo n.º 1
0
        /// <summary>
        /// Apply appropriate settings to the missile prop instance
        /// </summary>
        protected override void configureMissileProp()
        {
            // set lifecycle stage
            lifecycleStage = HellstormLifecycle.Launch;

            // apply settings to the missile
            missile.HasGravity = false;
            missile.MaxSpeed   = maxCruiseSpeed;

            // orient the missile towards the player. get normalized delta vector that points towards the player
            Vector3 directionVector = (Game.Player.Character.Position - missile.Position).Normalized;

            missile.Rotation = Helper.getEulerAngles(directionVector, invertThrust);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Apply missile flight control logic. Apply user input if enabled.
        /// </summary>
        /// <returns>Whether the control flow can proceed</returns>
        public override bool control()
        {
            // invoke base control method; if it returns false, stop execution
            if (!base.control())
            {
                return(false);
            }

            // calculate how long the missile has been created
            int age = Game.GameTime - creationTime;

            // check if it is necessary to transition to the next lifecycle stage
            switch (lifecycleStage)
            {
            case HellstormLifecycle.Launch:
                if (age >= launchStageTime)
                {
                    transitionToMissileCam(missileCamera);
                    lifecycleStage    = HellstormLifecycle.Cruise;
                    canControl        = true;
                    clusterBombsReady = true;
                }
                break;
            }

            // apply "thrust" to the missile; recall that the missile has a set maximum speed
            missile.ApplyForceRelative(cruisingThrustVector);

            // if user control is enabled, detect relevant user input
            if (canControl)
            {
                applyUserInput();
            }

            // mark Peds according to their relationship with the player
            targetObservablePeds();
            //DrawingHelper.markEntityOnScreen(Game.Player.Character, pedMarkerSprite);

            return(true);
        }