コード例 #1
0
ファイル: Minigame4.cs プロジェクト: heyx3/GGJ2014
 protected override void Update(Jousting.Jouster.CollisionData playerCollision)
 {
 }
コード例 #2
0
ファイル: Minigame.cs プロジェクト: heyx3/GGJ2014
 protected abstract void Update(Jousting.Jouster.CollisionData playerCollision);
コード例 #3
0
ファイル: Minigame3.cs プロジェクト: nolanmanning703/GGJ2014
        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);
        }
コード例 #4
0
ファイル: Minigame5.cs プロジェクト: nolanmanning703/GGJ2014
        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);
            }
        }