// this function changes the current state of the gameobject public void ChangeState(GeneralState newState) { // check that the current state isnt the new state that its being changed to if (currState != newState) { currState = newState; } }
public IndexModel(PoolControl poolControl, IViewLocalizer localizer) { this.State = poolControl.GetPoolControlInformation(); this.GeneralState = GeneralState.ConvertFromPoolState(poolControl.GetPoolControlInformation()); this.TemperatureRunTime = this.State.PoolSettings.TemperatureRunTime.ToArray(); this.PumpingCycles = this.State.PoolSettings.WorkingMode == PoolWorkingMode.Summer ? this.State.PoolSettings.SummerPumpingCycles : this.State.PoolSettings.WinterPumpingCycles; var chartOptions = new Highcharts { Title = new Title { Text = "" }, XAxis = new List <XAxis>() { new XAxis() { Title = new XAxisTitle() { Text = "°C" } } }, YAxis = new List <YAxis>() { new YAxis() { Title = new YAxisTitle() { Text = "h" } } }, Series = new List <Series>() { new AreaSeries { Name = "h", Data = this.State.PoolSettings.TemperatureRunTime .Select(d => new AreaSeriesData() { X = d.Temperature, Y = d.RunTimeHours }) .ToList(), } } }; chartOptions.ID = "chart"; this.ChartRenderer = new HighchartsRenderer(chartOptions); }
public void Toggle() { switch (State) { case GeneralState.Off: State = GeneralState.On; break; case GeneralState.On: State = GeneralState.Off; break; } PrintState(); }
public ActionResult Edit(GeneralStateViewModel model) { try { var svc = new GeneralStateAppService(); var o = new GeneralState { GeneralStateId= model.GeneralStateId, Name = model.Name, }; if (model.Action == "-1") { var exist = svc.GetGeneralState(model.GeneralStateId)!=null; if (!exist) { svc.AddGeneralState(o); ViewBag.Feed = 0; } else { model.Action = "-1"; ViewBag.Feed = 3; return View(model); } } else { o.GeneralStateId= model.GeneralStateId; if (model.IsDeleteAction == 0) { svc.SaveGeneralState(o); } else { svc.RemoveGeneralState(model.GeneralStateId); } ViewBag.Feed = 0; } } catch (Exception) { ViewBag.Feed = 1; } return View(model); }
protected void SetEnemyState(GeneralState newState) { enemyState.ChangeState(newState); }
// setting player state, mainly for cleaner code void SetPlayerState(GeneralState newState) { playerState.ChangeState(newState); }