Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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);
 }