public void StartRounds(TargetTypeCollection targetTypeCollection, List <RoundDefinition> roundDefinitions, PlayModel playModel) { this.targetTypeCollection = targetTypeCollection; this.roundDefinitions = roundDefinitions; targetController.Init(playModel, targetTypeCollection); roundCounter = 0; ExecuteRound(); }
public void Init(TargetTypeCollection targetTypeCollection, float roundDuration) { this.targetTypeCollection = targetTypeCollection; this.roundDuration = roundDuration; weightSum = 0; foreach (WhackTarget targetType in targetTypeCollection.targetTypes) { weightSum += targetType.Weight; } Random.InitState(System.DateTime.Now.Millisecond); timeBasedRandomState = Random.state; }
public RoundDefinition.SlotDefinition GenerateSlotDefinition(TargetTypeCollection targetTypeCollection, float weightSum) { RoundDefinition.SlotDefinition slotDefinition = new RoundDefinition.SlotDefinition(); //use the weights to select the targetType float weightSelection = Random.Range(0, weightSum); float localSum = 0; for (int i = 0; i < targetTypeCollection.targetTypes.Count; i++) { localSum += targetTypeCollection.targetTypes[i].Weight; if (weightSelection < localSum) { slotDefinition.targetTypeIndex = i; break; } } slotDefinition.timeBeforePresent = 0; return(slotDefinition); }
public void Init(PlayModel playModel, TargetTypeCollection targetTypeCollection) { this.playModel = playModel; this.targetTypeCollection = targetTypeCollection; }