public void ProcessTick(Move move, float dt)
 {
     if (puzzleObject.Position - origPosition == new Vector2(xDistance, yDistance))
     {
         puzzleObject.Physics.Velocity = Vector2.Zero;
         ProcessList.Instance.RemoveObject(puzzleObject);
     }
 }
        public void ProcessTick(Move move, float elapsed)
        {
            if (move != null)
            {
                // set our test object's Velocity based on stick/keyboard input
                _sceneObject.Physics.VelocityX = move.Sticks[0].X*20.0f;

                if(_sceneObject.Physics.VelocityX < 0)
                {
                    Orientation = Orientation.Left;

                    if(Action != Action.Walking)
                    {
                        ((T2DAnimatedSprite)_sceneObject).PlayAnimation(
                           TorqueObjectDatabase.Instance.FindObject<T2DAnimationData>(Game.Instance.Player + "Walking")
                        );
                    }

                    Action = Action.Walking;

                    _sceneObject.FlipX =Game.Instance.Player == "steve" ? true :false;
                }
                else if (_sceneObject.Physics.VelocityX > 0)
                {
                    Orientation = Orientation.Right;

                    if (Action != Action.Walking)
                    {
                        ((T2DAnimatedSprite)_sceneObject).PlayAnimation(
                           TorqueObjectDatabase.Instance.FindObject<T2DAnimationData>(Game.Instance.Player + "Walking")
                        );
                    }

                    Action = Action.Walking;

                    _sceneObject.FlipX = Game.Instance.Player == "steve" ? false : true;
                }
                else
                {
                    if (Action != Action.Standing)
                    {
                        ((T2DAnimatedSprite)_sceneObject).PlayAnimation(
                           TorqueObjectDatabase.Instance.FindObject<T2DAnimationData>(Game.Instance.Player + "Standing")
                        );
                    }

                    Action = Action.Standing;
                }
            }
        }
        /// <summary>
        /// Checks whether all the switches are on or not.  If they are,
        /// the puzzle object runs all specified behaviors.  If not,
        /// it just sits there and looks pretty.
        /// </summary>
        /// <param name="move">Some move crap that's not applicable to this component.</param>
        /// <param name="dt">The time passed since last update.</param>
        public virtual void ProcessTick(Move move, float dt)
        {
            if (!allSwitchesOn)
            {
                allSwitchesOn = true;
                foreach (SwitchTrigger switchObj in switches)
                    allSwitchesOn &= switchObj.IsOn;
            }

            if (allSwitchesOn)
            {
                foreach (PuzzleBehavior behavior in behaviors)
                    behavior.Run(SceneObject);// behavior.Execute(SceneObject);
            }
        }
        public virtual void ProcessTick(Move move, float elapsed)
        {
            if (playerEntered)
            {
                if(!camera.IsMoving)
                {
                    if (!transitionFinished)
                    {
                        transitionFinished = true;
                        hulk.PlayIntro();
                    }
                }

                if (hulk.AnimationManager.CurrentState.StateName == "intro")
                {
                    if (hulk.AnimatedSprite.CurrentFrame == hulk.AnimatedSprite.FinalFrame)
                    {
                        T2DSceneObject player = (T2DSceneObject)TorqueObjectDatabase.Instance.FindObject("Amanda");

                        camera.ReturnToPlayer(player, 200f);

                    }
                }

                if (hulk.AnimationManager.PreviousState != null)
                {
                    if (hulk.AnimationManager.PreviousState.StateName == "intro")
                    {
                        if (!camera.IsMoving)
                        {
                            camera.Zoom(0.5f, 3000f);
                            T2DSceneObject player = (T2DSceneObject)TorqueObjectDatabase.Instance.FindObject("Amanda");
                            PlayerActorComponent actor = player.Components.FindComponent<PlayerActorComponent>();
                            ((PlayerController)actor.Controller).TogglePlayerControl();
                            SceneObject.MarkForDelete = true;
                         }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        ///<summary>
        ///Called each tick
        ///</summary>
        ///<param name="move"></param>
        ///<param name="dt">
        ///The amount of elapsed time since the last call, in seconds.
        ///</param>
        public virtual void ProcessTick(Move move, float dt)
        {
            PauseEngineSound = Program.GamePaused;

            if (_engineCue == null)
                return;

            _engineCue.SetVariable(
                "EngineSpeed",
                (SceneObject.Physics.Velocity.LengthSquared() /
                 10000.0f * 100.0f)); //maxVelSq
            _engineCue.SetVariable(
                "AngularSpeed",
                (System.Math.Abs(SceneObject.Physics.AngularVelocity)
                 / 75.0f * 100.0f)); //maxAngVel
        }
        public override void ProcessTick(Move move, float elapsed)
        {
            #if DEBUG
            Profiler.Instance.StartBlock("T2DSceneCamera.ProcessTick");
            #endif

            // WARNING: changing the call order of the methods here could cause
            // camera interpolation bugs, camera jitter, or mounting failure - be
            // aware of any changes here!

            // what does this mean?
            // 1) base.StartTick should be explicitly called before any positions are
            // set so the previous tick can be logged and any changes in position
            // can be correctly recorded as occuring during "this tick"
            // 2) changes in position (camera animation and camera shake and any other
            // custom camera movements) happen next.
            // 3) base.ProcessTick must happen last. this is for two reasons. first, if
            // the camera is mounted it has to be updated after the camera has it's say
            // about where it wants to go. second, the tick is officially ended at the end
            // of base.ProcessTick, so if we change the position or try to start the tick
            // after that, the order will be screwed and interpolation won't work correctly.
            // 4) the actual view region of the camera is updated based on any changes to
            // position of rotation that might have just happened.

            // phew...
            // ...enough chatter, here it is:

            // 1) explicitly call StatTick here...
            // this is normally done in moving objects by the physics component,
            // but cameras don't require one. we need to call this to make sure that
            // position and rotation are interpolated and updated properly.
            base.StartTick();

            // 2) perform any position or rotation changes...
            // interpolate zoom and position
            _Animate();

            // upate camera shake
            _UpdateShake();

            // 3)call base.ProcessTick...
            // call T2DSceneObject's ProcessTick to update our position
            // based on our mountee's position (if we are mounted to another object)
            base.ProcessTick(move, elapsed);

            // 4) update the scene region...
            // recalculate our extents and transforms
            _UpdateSceneRegion();

            // see?
            // piece of cake! >_<;

            #if DEBUG
            Profiler.Instance.EndBlock("T2DSceneCamera.ProcessTick");
            #endif
        }
 /// <summary>
 /// IT2DForceGenerator interface method. Called by the Physics component after the current move is processed.
 /// </summary>
 /// <param name="move">Move is generally ignored by MoveComponents because their control is intended to come from 
 /// a MoveController, rather than user input.</param>
 /// <param name="elapsed">Elapsed time since last PostUpdateForces call.</param>
 public virtual void PostUpdateForces(Move move, float elapsed)
 {
     _postUpdate(elapsed);
 }
 public void ProcessTick(Move move, float dt)
 {
     obj.Position += new Vector2((float)Math.Sin(dt * 100), 0);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Called each tick
        /// </summary>
        /// <param name="dt">
        /// The amount of elapsed time since the last call, in seconds.
        /// </param>
        public virtual void ProcessTick(Move move, float dt)
        {
            if (MyGame.Instance.GamePaused)
                return;

            if (_goalRegulator.IsReady)
            {
                GenerateGoal();
            }
        }
        public override void ProcessTick(Move move, float elapsed)
        {
            base.ProcessTick(move, elapsed);

            // don't allow spawning if we're not enabled
            if (!_spawnEnabled)
                return;

            _currentTime += (elapsed * 1000.0f);

            if (_currentTime >= _nextSpawn)
            {
                DoSpawn();

                Assert.Fatal(_maxSpawnTime >= _minSpawnTime, "T2DSpawnObject::ProcessTick: MaxSpawnTime is less than MinSpawnTime!");
                if (_maxSpawnTime < _minSpawnTime)
                    _maxSpawnTime = _minSpawnTime;

                // generate a new spawn time
                _nextSpawn = TorqueUtil.GetRandomFloat(_minSpawnTime, _maxSpawnTime);

                // make sure we didn't generate a negative time
                Assert.Fatal(_nextSpawn >= 0.0f, "T2DSpawnObject::ProcessTick: spawn rate is negative!");
                if (_nextSpawn < 0.0f)
                    _nextSpawn = 0.0f;

                _nextSpawn += _currentTime;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Called each tick
        /// </summary>
        /// <param name="dt">
        /// The amount of elapsed time since the last call, in seconds.
        /// </param>
        public virtual void ProcessTick(Move move, float dt)
        {
            if (MindcraftersComponentLibrary.GamePaused)
                return;

            // todo: perform processing for component here
        }
        /// <summary>
        /// Generates move for the move manager.  In order to generate a new move type one would
        /// derive a new class from Move and a new move manager type from MoveManager.  Then one
        /// would override this method to generate moves of the desired type.  Call base._GenerateMove
        /// with a move of the desired type to have base class fill in the buttons, triggers,
        /// levers, and sticks.  If simply using stock moves, there is no need to override this
        /// method.
        /// </summary>
        /// <param name="move">The move to fill in if already generated (by derived class) or null if creating move is our responsibility.</param>
        /// <returns>New move.</returns>
        protected internal virtual Move _GenerateMove(Move move)
        {
            // we may or may not supply our own move
            if (move == null)
                move = _move;

            // but we will always set the move data we know about ourself
            move._buttons = _buttons;
            move._triggers = _triggers;
            move._levers = _levers;
            move._sticks = _sticks;
            return move;
        }
Ejemplo n.º 13
0
        ///<summary>
        ///Called each tick
        ///</summary>
        ///<param name="move"></param>
        ///<param name="dt">
        ///The amount of elapsed time since the last call, in seconds.
        ///</param>
        public virtual void ProcessTick(Move move, float dt)
        {
            float inputParameter = 0;
            if (null != _monitoredInterface &&
                null != _monitoredObject && _monitoredObject.IsRegistered)
            {
                inputParameter = _monitoredInterface.Value;
            }

            float fractionOfMax = (inputParameter - _minRange) / _maxRange;
            if (_reverse)
                SceneObject.Rotation =
                    fractionOfMax * -360.0f + _rotationOffset;
            else
                SceneObject.Rotation =
                    fractionOfMax * 360.0f + _rotationOffset;
        }
Ejemplo n.º 14
0
        public void ProcessTick(Move move, float dt)
        {
            if (Math.Abs(_scrollAmountX) > 0.1f)
                ScrollX(_scrollAmountX * _scrollSpeed);

            if (Math.Abs(_scrollAmountY) > 0.1f)
                ScrollY(_scrollAmountY * _scrollSpeed);
        }
        public virtual void ProcessTick(Move move, float elapsed)
        {
            if (playerHasControl)
            {
                // check if move exists
                if (move != null)
                {
                    // set horizontal actor movement flags
                    if (move.Sticks[0].X < 0)
                        _moveLeft();
                    else if (move.Sticks[0].X > 0)
                        _moveRight();
                    else
                        _horizontalStop();

                    // keep track of whether or not the down button is pressed
                    // (so we know whether this is a normal jump, or a down-jump)
                    bool movingDown = false;

                    // set vertical actor movement flags
                    if (move.Sticks[0].Y < -0.25)
                    {
                        _moveDown();
                        movingDown = true;
                    }
                    else
                        _verticalStop();

                    // set jump only on initial button down and button release
                    if (move.Buttons[0].Pushed)
                    {
                            _jump();

                            if (movingDown)
                                _jumpDown();

                    }

                    // set attack only on initial button down and button release
                    if (move.Buttons[1].Pushed)
                    {
                        if (!_attackButton)
                        {
                            foreach (PlayerActorComponent actor in Movers)
                                actor.Punch();

                            _attackButton = true;
                        }
                    }

                    else if (move.Buttons[2].Pushed)
                    {
                        if (!_attackButton)
                        {
                            foreach (PlayerActorComponent actor in Movers)
                                actor.Swipe();

                            _attackButton = true;
                        }
                    }

                    else if (move.Triggers[0].Value == 1 ||
                        move.Buttons[3].Pushed)
                    {
                        if (!_attackButton)
                        {
                            foreach (PlayerActorComponent actor in Movers)
                                actor.Shoot();

                            _attackButton = true;
                        }
                    }

                    else if (_attackButton)
                    {
                        _attackButton = false;
                    }
                }
            }
        }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(TriggerIndex >= 0 && TriggerIndex < move.Triggers.Count, "TriggerIndex out of range");
                if (TriggerIndex >= move.Triggers.Count || TriggerIndex < 0)
                    return;

                float input = move.Triggers[TriggerIndex].Value;
                _Update(ref val, input, false);
            }
        public virtual void ProcessTick(Move move, float elapsed)
        {
            // check distance and spawn objects if appropriate
            if (_proximityTarget == null)
                return;

            // check for objects to spawn
            if (SpawnCount < SpawnLimit)
            {
                float distance = Vector2.Distance(ProximityBasisObject.Position, _proximityTarget.Position);

                if (distance <= _maxSpawnDistance && distance >= _minSpawnDistance)
                    Spawn();
            }

            // check for objects to despawn
            if (_autoDespawn && SpawnedObjects.Count > 0)
            {
                for (int i = 0; i < SpawnedObjects.Count; i++)
                {
                    T2DSceneObject obj = SpawnedObjects[i];

                    if (obj == null)
                        continue;

                    // if they are not the same direction away, skip
                    if ((obj.Position.X - Target.Position.X < 0) != (ProximityBasisObject.Position.X - Target.Position.X < 0))
                        continue;

                    float distance = Vector2.Distance(ProximityBasisObject.Position, _proximityTarget.Position);
                    float objDistance = Vector2.Distance(obj.Position, _proximityTarget.Position);

                    // if they are far enough away and the spawn point is far enough away, despawn!
                    if (distance > _maxSpawnDistance * 1.5 && objDistance > _maxSpawnDistance * 1.5)
                    {
                        Despawn(obj);

                        // decrement the counter
                        // (one fewer object)
                        i--;
                    }
                }
            }
        }
 public void ProcessTick(Move move, float dt)
 {
     for (int i = 0; i < _processors.Count; i++)
     {
         ProcessData pd = _processData[i];
         float val = pd.Interface.Value;
         pd.PreTick = val;
         _processors[i].Process(move, dt, ref val);
         pd.Interface.Value = val;
         pd.PostTick = val;
         _processData[i] = pd;
     }
 }
Ejemplo n.º 19
0
 ///<summary>
 ///Called everytime the engine processes a tick. This is guaranteed to
 ///happen at the tick rate, though it may not happen at the exact tick
 ///boundaries.
 ///</summary>
 ///<param name="move">
 ///The move structure that contains information about user input.
 ///</param>
 ///<param name="dt">
 ///The amount of time passed. This is always the tick rate.
 ///</param>
 public void ProcessTick(Move move, float dt)
 {
     FSM.Instance.Execute(this);
 }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(ButtonIndex >= 0 && ButtonIndex < move.Buttons.Count, "ButtonIndex out of range");
                if (ButtonIndex >= move.Buttons.Count || ButtonIndex < 0)
                    return;

                float input = move.Buttons[ButtonIndex].Pushed ? 1.0f : 0.0f;
                _Update(ref val, input, false);
            }
 public void ProcessTick(Move move, float elapsed)
 {
     // call update on this AI controller
     _update();
 }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(LeverIndex >= 0 && LeverIndex < move.Levers.Count, "LeverIndex out of range");
                if (LeverIndex >= move.Levers.Count || LeverIndex < 0)
                    return;

                float input = move.Levers[LeverIndex].Value;
                input = 0.5f * (input + 1.0f);
                _Update(ref val, input, false);
            }
Ejemplo n.º 23
0
        ///<summary>
        ///Called each tick
        ///</summary>
        ///<param name="move"></param>
        ///<param name="dt">
        ///The amount of elapsed time since the last call, in seconds.
        ///</param>
        public virtual void ProcessTick(Move move, float dt)
        {
            if (Program.GamePaused)
            {
                //TODO: save velocity. zero on pause. restore on no pause?
                return;
            }

            ForwardThrust = MathHelper.Clamp(ForwardThrust, 0.0f, 1.0f);
            ReverseThrust = MathHelper.Clamp(ReverseThrust, 0.0f, 1.0f);
            LateralThrust = MathHelper.Clamp(LateralThrust, -1.0f, 1.0f);
            AngularThrust = MathHelper.Clamp(AngularThrust, -1.0f, 1.0f);
            Braking = MathHelper.Clamp(Braking, 0.0f, 1.0f);

            _heading.Value = SceneObject.Rotation;

            //Rotation
            SceneObject.Physics.AngularVelocity *= AngularDamping;
            SceneObject.Physics.AngularVelocity += (1.0f - AngularDamping) *
                AngularThrust * MaxAngularSpeed;

            //Forwards and Backwards
            SceneObject.Physics.VelocityX *= Damping;
            SceneObject.Physics.VelocityY *= Damping;

            SceneObject.Physics.VelocityX += (1.0f - Damping) *
                (float)System.Math.Sin(MathHelper.ToRadians(
                                           SceneObject.Rotation)) *
                (ForwardThrust * MaxForwardSpeed -
                ReverseThrust * MaxReverseSpeed);
            SceneObject.Physics.VelocityY -= (1.0f - Damping) *
                (float)System.Math.Cos(MathHelper.ToRadians(
                                           SceneObject.Rotation)) *
                (ForwardThrust * MaxForwardSpeed -
                ReverseThrust * MaxReverseSpeed);

            //Lateral thrust
            if (!LateralThrustEnabled)
                return;

            SceneObject.Physics.VelocityX +=
                (1.0f - Damping) *
                (float)System.Math.Cos(
                    MathHelper.ToRadians(SceneObject.Rotation)) *
                    LateralThrust * MaxLateralSpeed;
            SceneObject.Physics.VelocityY +=
                (1.0f - Damping) *
                (float)System.Math.Sin(
                    MathHelper.ToRadians( SceneObject.Rotation)) *
                    LateralThrust * MaxLateralSpeed;
        }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(StickIndex >= 0 && StickIndex < move.Sticks.Count, "StickIndex out of range");
                if (StickIndex >= move.Sticks.Count || StickIndex < 0)
                    return;

                float x = move.Sticks[StickIndex].X;
                float y = move.Sticks[StickIndex].Y;
                float len = (float)Math.Sqrt(x * x + y * y);
                _Update(ref val, len, false);
            }
Ejemplo n.º 25
0
        /// <summary>
        /// Called each tick
        /// </summary>
        /// <param name="dt">
        /// The amount of elapsed time since the last call, in seconds.
        /// </param>
        public virtual void ProcessTick(Move move, float dt)
        {
            if (MindcraftersComponentsLibrary.GamePaused)
                return;

            // Timer to restrict how fast a tank shell may be fired.
            if (_countdownToFire > 0f)
            {
                _countdownToFire -= dt;
            }

            if (!IsAI && move != null)
            {
                // The user has requested a tank shell be fired.
                if (move.Buttons[0].Pushed)
                {
                    if (_countdownToFire <= 0f)
                    {
                        _Fire();
                    }
                }
            }
            else if (IsAI && _HaveTargetInLOS())
            {
                if (_countdownToFire <= 0f)
                {
                    _Fire();
                }
            }
        }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(StickIndex >= 0 && StickIndex < move.Sticks.Count, "StickIndex out of range");
                if (StickIndex >= move.Sticks.Count || StickIndex < 0)
                    return;

                float x = move.Sticks[StickIndex].X;
                float y = move.Sticks[StickIndex].Y;
                if (x * x + y * y < 0.01f)
                    // zero length, can't determine angle so leave angle as is
                    return;
                float invLen = 1.0f / (float)Math.Sqrt(x * x + y * y);
                x *= invLen;
                y *= invLen;
                float theta = (float)Math.Acos(-x);
                if (y < 0.0f)
                    theta = -theta;
                float targetRotation = (MathHelper.ToDegrees(theta) + 270.0f) % 360.0f;

                _Update(ref val, targetRotation, true);
            }
        public virtual void ProcessTick(Move move, float elapsed)
        {
            if (!_fallTriggered)
                return;

            _totalElapsed += elapsed;

            if (_totalElapsed >= _timeout)
                _platform.Physics.VelocityY += _gravity * elapsed * 100;

            if (!(Owner.IsRegistered && _totalElapsed >= _timeout + _deleteAfterFallTimeout))
                return;

            _platformComponent.PlatformEnabled = false;

            if (!Owner.TestObjectType(PlatformerData.SpawnedObjectType))
            {
                TorqueObjectDatabase.Instance.Unregister(Owner);
                return;
            }

            SpawnedObjectComponent spawnedObject = Owner.Components.FindComponent<SpawnedObjectComponent>();

            if (_autoRecover && spawnedObject != null)
                spawnedObject.SpawnPoint.ResetSpawnPoint();
            else
                TorqueObjectDatabase.Instance.Unregister(Owner);
        }
 /// <summary>
 /// Processor does it's work in this method.  If writing your own Processor this is
 /// where you do your thing.
 /// </summary>
 /// <param name="move">The move passed into ProcessTick for the object.</param>
 /// <param name="dt">The elapsed time, in seconds, passed into ProcessTick for the object.</param>
 /// <param name="val">The output value.</param>
 public abstract void Process(Move move, float dt, ref float val);
        public void ProcessTick(Move move, float dt)
        {
            #if DEBUG
            Profiler.Instance.StartBlock(Profiler_ProcessTick);
            #endif
            T2DSceneObject sceneObject = SceneObject;
            sceneObject.StartTick();

            if (sceneObject.IsMounted)
            {
                // scene object handles mount behavior
                if (AngularVelocity != 0.0f)
                    sceneObject.SetRotation(sceneObject.Rotation + AngularVelocity * dt, false);

                // slam this component with it's mount parent's velocity values
                if (sceneObject.MountedTo != null && sceneObject.MountedTo.Physics != null)
                {
                    Velocity = SceneObject.MountedTo.Physics.Velocity;
                    if (sceneObject.TrackMountRotation)
                        AngularVelocity = sceneObject.MountedTo.Physics.AngularVelocity;
                }

            #if DEBUG
                Profiler.Instance.EndBlock(Profiler_ProcessTick);
            #endif
                return;
            }

            // apply forces for this turn
            if (_forceGenerators != null)
            {
                for (int i = 0; i < _forceGenerators.Count; i++)
                {
                    _forceGenerators[i].Wrap.PreUpdateForces(move, dt);
                }
            }

            bool atRest = false;
            if (!_processCollisionsAtRest && Math.Abs(_velocity.X) < Epsilon.Value && Math.Abs(_velocity.Y) < Epsilon.Value && Math.Abs(_angularVelocity) < Epsilon.Value)
            {
                // clamp velocity to zero and short cut collision checking.
                _velocity.X = 0.0f;
                _velocity.Y = 0.0f;
                _angularVelocity = 0.0f;
                atRest = true;
            }

            int iterations = 5;
            while (iterations-- > 0 && dt > 0.00001f)
            {
                float firstCollideTime = dt;

                _collisions.Clear();

                // only check collisions if we haven't already exhausted all checking...just move if we can't
                // resolve (note: this gives objects every opportunity to behave properly but still prevents
                // them from getting stuck...which is worse than minor tunneling/penetration issues).
                if (iterations > 0)
                {
                    if (sceneObject.Collision != null && !atRest)
                        sceneObject.Collision.TestMove(ref firstCollideTime, _velocity, _collisions);
                    else if (!atRest && sceneObject.WorldLimit != null)
                        sceneObject.WorldLimit.TestMove(ref firstCollideTime, _velocity, _collisions);
                }

                if (firstCollideTime > 0.0f && _collisions.Count != 0)
                {
                    // back off a little pre-collision
                    firstCollideTime = MathHelper.Max(firstCollideTime - 0.001f, 0.0f);
                }

                if (firstCollideTime > 0.0f)
                {
                    // integrate position and rotation
                    if (!atRest)
                    {
                        sceneObject.SetPosition(sceneObject.Position + Velocity * firstCollideTime, false);
                        // Note: this is different than TGB.  In TGB, don't rotate if we collide.
                        sceneObject.SetRotation((sceneObject.Rotation + AngularVelocity * firstCollideTime + 360.0f) % 360.0f, false);
                    }
                }
                else if (sceneObject.Collision == null || sceneObject.Collision.SolveOverlap)
                {
                    Vector2 penetration = new Vector2();

                    // need to resolve overlap
                    for (int i = 0; i < _collisions.Count; i++)
                    {
                        float pushScale = 1.05f;
                        float ourInvMass = InverseMass;
                        float theirInvMass = 0.0f;
                        T2DSceneObject theirObj = _collisions[i].SceneObject;
                        if (theirObj != null)
                        {
                            if (theirObj.Collision != null && !theirObj.Collision.SolveOverlap)
                                // if they don't solve overlap, don't solve overlap even though it's our turn
                                continue;
                            if (theirObj.Physics != null)
                                theirInvMass = theirObj.Physics.InverseMass;
                        }

                        if (ourInvMass > Epsilon.Value || theirInvMass < Epsilon.Value)
                        {
                            // displace us -- either we're movable or they're immovable
                            Vector2 addPenetration = pushScale * _collisions[i].Penetration;
                            float len2 = penetration.LengthSquared();
                            // If we have multiple contacts we need to be careful about adding up sources of
                            // penetration.  In the following we make sure not to accumulate the same penetration
                            // multiple times.
                            if (len2 > Epsilon.Value)
                                addPenetration -= (Vector2.Dot(penetration, addPenetration) / len2) * penetration;
                            penetration += addPenetration;
                        }
                        else // (ourInvMass <= Epsilon.Value && theirInvMass >= Epsilon.Value)
                        {
                            // displace them -- special case in which we're immovable and we ram something which isn't
                            theirObj.Position = theirObj.Position - pushScale * _collisions[i].Penetration;
                        }
                    }
                    sceneObject.SetPosition(sceneObject.Position + penetration, false);
                }

                // allow force generators to apply forces for elapsed time
                if (_forceGenerators != null)
                {
                    for (int i = 0; i < _forceGenerators.Count; i++)
                    {
                        // how do we handle force generator that moves object rather than
                        // pushes it?  undo work? convert to 1 time velocity?
                        _forceGenerators[i].Wrap.PostUpdateForces(move, firstCollideTime);
                    }
                }

                _ResolveCollisions(_collisions);
                atRest = false;

                // get rid of objects marked for delete so that
                // we don't run into things that are going away
                if (Owner != null)
                    sceneObject.Manager.DeleteMarkedObjects();

                if (Owner == null)
                {
            #if DEBUG
                    Profiler.Instance.EndBlock(Profiler_ProcessTick);
            #endif
                    // deleted ourself... get out now
                    return;
                }

                dt -= firstCollideTime;
            }

            sceneObject.UpdateSpatialData();

            #if DEBUG
            Profiler.Instance.EndBlock(Profiler_ProcessTick);
            #endif
        }
            public override void Process(Move move, float dt, ref float val)
            {
                if (move == null)
                    return;

                Assert.Fatal(StickIndex >= 0 && StickIndex < move.Sticks.Count, "StickIndex out of range");
                if (StickIndex >= move.Sticks.Count || StickIndex < 0)
                    return;

                float input = Axis == 0 ? move.Sticks[StickIndex].X : move.Sticks[StickIndex].Y;
                input = 0.5f * (input + 1.0f);
                _Update(ref val, input, false);
            }