Exemplo n.º 1
0
        public override void UpdateParent(GameTime gameTime)
        {
            writer.Update(gameTime);
            Dialogue.Update(gameTime);

            for (int i = children.Count - 1; i >= 0; i--)
            {
                if (children[i].Dead())
                {
                    physical.Remove(children[i] as ICollide);
                    children.RemoveAt(i);
                }
            }

            physical.Collide((float)gameTime.ElapsedGameTime.TotalMilliseconds);

            var kstate = Keyboard.GetState();

            if (kstate.IsKeyDown(Keys.V))
            {
                NextScene = DemoScene2.Instance;
            }

            Color color       = Color.Black;
            float lengthOfDay = 12000;
            float timeOfDay   = (float)gameTime.TotalGameTime.TotalMilliseconds % lengthOfDay / lengthOfDay;

            if (timeOfDay < .25)
            {
                color = Color.MidnightBlue;
            }
            else if (timeOfDay < .375)
            {
                color = Color.Lerp(Color.MidnightBlue, Color.LightSkyBlue, (timeOfDay - .25f) / .125f);
            }
            else if (timeOfDay < .5)
            {
                color = Color.Lerp(Color.LightSkyBlue, Color.White, (timeOfDay - .375f) / .125f);
            }
            else if (timeOfDay < .75)
            {
                color = Color.White;
            }
            else if (timeOfDay < .875)
            {
                color = Color.Lerp(Color.White, Color.Chocolate, (timeOfDay - .75f) / .125f);
            }
            else
            {
                color = Color.Lerp(Color.Chocolate, Color.MidnightBlue, (timeOfDay - .875f) / .125f);
            }
            //Atmosphere = color;
        }
Exemplo n.º 2
0
        public void TriArrayErrorCase()
        {
            PhysicsGroup physicsGroup = new PhysicsGroup(PhysicsGroupType.Physical);

            DemoMap demoMap = new DemoMap();
            Player  player  = new Player(new RBGNature.Camera());

            player.collision = new Circle()
            {
                Radius   = 10,
                Mass     = 1,
                Position = new Vector2(170.716476f, 303.425659f),
                Velocity = new Vector2(-0.17978698f, 0.0744702f)
            };

            physicsGroup.Add(demoMap);
            physicsGroup.Add(player);

            physicsGroup.Collide(16.6488f);

            player.Update(new GameTime());

            Assert.IsTrue(player.collision.Position.X + player.collision.Position.Y > 460 + Math.Sqrt(2) * 10);
        }