/// <summary>
 /// Decides how to handle the input based on the
 /// editing mode that is selected
 /// </summary>
 public void UpdateInput(Dictionary <int, Individual> supers, ControlGroups groups)
 {
     if (StaticEditModeParameters.IsBrushMode())
     {
         if (supers.Count > 0)
         {
             this.Update(new Vector2((float)supers[0].X, (float)supers[0].Y), groups);
         }
         else
         {
             this.Update(Vector2.Zero, groups);
         }
     }
     else if (StaticEditModeParameters.IsEraseMode())
     {
         if (supers.Count > 0)
         {
             EraseIndividual(supers[0].Position, groups);
         }
     }
     else if (StaticEditModeParameters.IsWorldMode())
     {
         this.Update(Vector2.Zero, groups);
     }
 }
Beispiel #2
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (this.IsActive)
            {
                swarmInXOrder = populationSimulator.GetSwarmInXOrder();

                foreach (var group in groups)
                {
                    //debugComponent.AddDebugItem(group.Key.ToString(), group.Key + "  " + group.Value);
                }

                analysisComponent.Update(swarmInXOrder, ScreenManager.GraphicsDevice.Viewport.Bounds, gameTime);
                Border.Update(swarmInXOrder);
                emitterComponent.UpdateInput(supers, groups);

                if (StaticEditModeParameters.IsEraseMode() ||
                    StaticEditModeParameters.IsBrushMode())
                {
                    populationSimulator.stepSimulation(supers.Values.ToList <Individual>(), 0);
                }
                else
                {
                    populationSimulator.stepSimulation(supers.Values.ToList <Individual>(), 20);
                }

                Camera.Update(gameTime);
            }
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }