Beispiel #1
0
        private void updateParameters()
        {
            Parameters.Clear();
            BoidSpecies        selected = null;
            List <BoidSpecies> test     = (List <BoidSpecies>)_mvm.Simulation.Species;

            foreach (BoidSpecies species in test)
            {
                if (species.Name.Equals(FirstSelectedValue))
                {
                    selected = species;
                }
            }
            var Bindings  = selected.Bindings;
            var inbetween = Bindings.Parameters;

            foreach (var data in inbetween)
            {
                if (data is RangedDoubleParameter)
                {
                    var d = (RangedDoubleParameter)data;

                    var paramContent = selected.Bindings.Read(d);

                    Parameters.Add(new SliderParameter(d.Id, paramContent, d.Minimum, d.Maximum));
                }
            }
        }
 public SpeciesViewModel(BoidSpecies species, SimulationViewModel parent)
 {
     this.sim        = parent;
     this.Species    = species;
     this.AddSpecies = new AddSpeciesCommand(this);
     Parameters      = new ParametersViewModel(species.Bindings);
 }
Beispiel #3
0
 public Boid(World world, Vector2D position, BoidSpecies species)
 {
     this.World    = world;
     this.Position = Cell.Create(position);
     this.Velocity = Cell.Create(new Vector2D(0, 0));
     this.Species  = species;
     this.AI       = species.CreateAI(this);
     this.Bindings = new ParameterBindings("Boid", species.Bindings);
 }
Beispiel #4
0
        private void CreateBoid(BoidSpecies specie)
        {
            int    index = this.simulation.Species.IndexOf(specie);
            Random rnd   = new Random();
            double x     = rnd.Next(1, (int)Simulation.World.Width.Value);
            double y     = rnd.Next(1, (int)Simulation.World.Height.Value);

            this.simulation.Species[index].CreateBoid(new Vector2D(x, y));
        }
Beispiel #5
0
 private void DeleteBoid(BoidSpecies specie)
 {
     foreach (Boid boid in this.simulation.World.Population)
     {
         if (boid.Species == specie)
         {
             this.simulation.World.Population.Remove(boid);
             break;
         }
     }
 }
        public SpeciesViewModel(BoidSpecies species)
        {
            this.species = species;

            Parameters = new ObservableCollection <RangedParamViewModel>();
            foreach (IParameter param in Bindings.Parameters)
            {
                if (param is RangedDoubleParameter)
                {
                    Parameters.Add(new RangedParamViewModel(Bindings, (RangedDoubleParameter)param));
                }
            }
        }
 public SpeciesViewModel(BoidSpecies BoidSpecies)
 {
     this.BoidSpecies = BoidSpecies;
     //CreateBoid = new CreateBoidCommand(BoidSpecies);
     ResetSpeciesParameters = new ResetSpeciesParametersCommand(this);
 }
 public SpeciesViewModel(BoidSpecies specie)
 {
     this.specie = specie;
 }