Exemple #1
0
 protected override void Update(Jousting.Jouster.CollisionData playerCollision)
 {
 }
Exemple #2
0
 protected abstract void Update(Jousting.Jouster.CollisionData playerCollision);
Exemple #3
0
        protected override void Update(Jousting.Jouster.CollisionData playerCollision)
        {
            HarmonyInsideHill = HillShape.Touches(Harmony.ColShape);
            if (HarmonyInsideHill)
            {
                TimeInHill += (float)World.CurrentTime.ElapsedGameTime.TotalSeconds;
            }

            if (TimeInHill > PhysicsData3.TimeInHillToWin)
            {
                MoveUp = true;
                return;
            }

            //Cause friction.
            for (int i = 0; i < PhysicsData3.NumbTennisBalls; ++i)
            {
                Jousting.Blocker ball = Blockers[i + 1];

                //If the friction this frame is strong enough to stop the ball, manually stop it.
                float fricPerFrame = Jousting.Jouster.PhysData.Friction * (float)World.CurrentTime.ElapsedGameTime.TotalSeconds;
                if (fricPerFrame * fricPerFrame >= ball.Velocity.LengthSquared())
                {
                    ball.Velocity = Vector2.Zero;
                }
                //Otherwise, apply friction like normal.
                else
                {
                    Vector2 vel = ball.Velocity;
                    vel.Normalize();
                    ball.Acceleration += -vel * Jousting.Jouster.PhysData.Friction * ball.Mass;
                }
            }

            ArtAssets3.HillSprite.UpdateAnimation(World.CurrentTime);
            ArtAssets3.ConfusedSprite.UpdateAnimation(World.CurrentTime);
            ArtAssets3.HarmonyJousterStill.UpdateAnimation(World.CurrentTime);
            ArtAssets3.DischordJousterStill.UpdateAnimation(World.CurrentTime);
        }
Exemple #4
0
        protected override void Update(Jousting.Jouster.CollisionData playerCollision)
        {
            Utilities.Math.Shape.Circle blackHole = BlackHoleCol;
            V2 harmonyToBH = UsefulMath.FindDirection(Harmony.Pos, blackHole.Center, false);
            V2 dischordToBH = UsefulMath.FindDirection(Dischord.Pos, blackHole.Center, false);

            float scale = WorldData.ZoomScaleAmount[World.CurrentZoom];

            Harmony.Acceleration = V2.Normalize(harmonyToBH) * PhysicsData5.GetBlackHolePull(harmonyToBH.Length(), scale);
            Dischord.Acceleration = V2.Normalize(dischordToBH) * PhysicsData5.GetBlackHolePull(dischordToBH.Length(), scale);
            foreach (Jousting.Blocker blocker in Blockers)
            {
                blocker.Acceleration = UsefulMath.FindDirection(blocker.Pos, blackHole.Center) *
                                       PhysicsData5.GetBlackHolePull((blocker.Pos - blackHole.Center).Length(), scale);

            }

            //Keep all rings facing the right way.
            for (int i = 1; i < Blockers.Count; ++i)
            {
                Blockers[i].Rotation = UsefulMath.FindRotation(Blockers[i].Velocity);
            }
        }