Esempio n. 1
0
        public override double Sense(Universe universe, CreatureElement parent)
        {
            Vector orientation = parent.Orientation + DirectionFromParent;
            Vector displacement;
            double foodSense = 0;

            foreach (FoodElement food in universe.Elements.OfType<FoodElement>())
            {
                displacement = food.Position - parent.Position;

                if (Vector.AngleBetween(orientation, displacement) < Range)
                {
                    foodSense += (1 / displacement.LengthSquared) * food.GetSize();
                }
            }

            return foodSense;
        }
Esempio n. 2
0
 public PlaygroundElement(Universe universe)
 {
     Universe = universe;
 }
Esempio n. 3
0
 public Engine()
 {
     Universe = new Universe();
 }
Esempio n. 4
0
 public abstract double Sense(Universe universe, Vector parentDirection);
Esempio n. 5
0
 public abstract double Sense(Universe universe, Vector parentDirection);