public StateData() { this.dragon = new FrontEndObjective(); this.baron = new FrontEndObjective(); this.blueDragons = new List <string>(); this.redDragons = new List <string>(); this.blueGold = 2500; this.redGold = 2500; }
public void SetObjectiveData(BackEndObjective back, FrontEndObjective front, double time) { //Generate text version of time for frontend back.DurationRemaining = time; TimeSpan t = TimeSpan.FromSeconds(time); front.DurationRemaining = t.ToString(@"mm\:ss"); //Gold differences since objective was taken var originalDiff = back.BlueStartGold - back.RedStartGold; var currentDiff = stateData.blueGold - stateData.redGold; //Check if blue has the objective to determine in which direction the gold difference should go var blueHasObjective = (front.Objective.GetObjectiveType() == Objective.ObjectiveType.Baron)? blueTeam.hasBaron : blueTeam.hasElder; //Difference between the gold gained inverted based on if Blue or Red team has the objective front.GoldDifference = (currentDiff - originalDiff) * (blueHasObjective ? 1 : -1); }