Beispiel #1
0
        private void AddPredator(double x, double y, Gender g)
        {
            var c = new Predator(new Point3D(x, y, 0), null, null);

            c.Gender = g;
            Add(c);
        }
Beispiel #2
0
        private void reproduceAction(Creature mother, Creature father)
        {
            Creature c;

            if (mother.GetType() == typeof(Creature))
            {
                c = new Creature(mother.Position, mother, father);
            }
            else
            {
                c = new Predator(mother.Position, mother, father);
            }
            c.ReproduceAction = reproduceAction;

            newCreatures.Add(c);
            view1.Children.Add(c);
        }
Beispiel #3
0
        private void view1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var pt = view1.FindNearestPoint(e.GetPosition(view1));

            if (!pt.HasValue)
            {
                return;
            }
            Creature c;

            if (Keyboard.IsKeyDown(Key.LeftCtrl))
            {
                c = new Predator(new Point3D(pt.Value.X, pt.Value.Y, 0), null, null);
            }
            else
            {
                c = new Creature(new Point3D(pt.Value.X, pt.Value.Y, 0), null, null);
            }
            Add(c);
        }
        private void reproduceAction(Creature mother, Creature father)
        {
            Creature c;
            if (mother.GetType() == typeof(Creature))
                c = new Creature(mother.Position, mother, father);
            else
                c = new Predator(mother.Position, mother, father);
            c.ReproduceAction = reproduceAction;

            newCreatures.Add(c);
            view1.Children.Add(c);
        }
 private void AddPredator(double x, double y, Gender g)
 {
     var c = new Predator(new Point3D(x, y, 0), null, null);
     c.Gender = g;
     Add(c);
 }
 private void view1_MouseDown(object sender, MouseButtonEventArgs e)
 {
     var pt = view1.FindNearestPoint(e.GetPosition(view1));
     if (!pt.HasValue)
         return;
     Creature c;
     if (Keyboard.IsKeyDown(Key.LeftCtrl))
         c = new Predator(new Point3D(pt.Value.X, pt.Value.Y, 0), null, null);
     else
         c = new Creature(new Point3D(pt.Value.X, pt.Value.Y, 0), null, null);
     Add(c);
 }