Пример #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;
        }
Пример #2
0
 public PlaygroundElement(Universe universe)
 {
     Universe = universe;
 }
Пример #3
0
 public Engine()
 {
     Universe = new Universe();
 }
Пример #4
0
 public abstract double Sense(Universe universe, Vector parentDirection);
Пример #5
0
 public abstract double Sense(Universe universe, Vector parentDirection);