Ejemplo n.º 1
0
        /// <summary>
        /// Test mover collisions.
        /// </summary>
        private void TestMoverCollision()
        {
            if (Exists(EntityType.Test))
            {
                List <Entity> tests  = GetEntities(EntityType.Test);
                List <Entity> npcs   = new List <Entity>();
                TestMover     player = null;

                foreach (Entity e in tests)
                {
                    if (e is TestMover)
                    {
                        if (((TestMover)e).PlayerControl)
                        {
                            player = (TestMover)e;
                        }
                        else
                        {
                            npcs.Add(e);
                        }
                    }
                }

                if (player != null)
                {
                    foreach (Entity e in tests)
                    {
                        TestMover test = (TestMover)e;

                        if (test.Collision(player))
                        {
                            // test.DrawColor = Color.Red;
                            test.Randomize();
                        }
                        else if (test.Proximity(player))
                        {
                            // test.DrawColor = Color.LimeGreen;
                        }
                        else
                        {
                            // test.DrawColor = Color.White;
                        }
                    }
                }
            }
        }