public int RequestPitchLocation(TypeOfPitch type, int lastSourceIndex = -1) { //Default Case //if(type == TypeOfPitch.FromAnywhere) int nextLocationIndex = Random.Range(0, SpawnLocations.Length); if (type == TypeOfPitch.FromAbove) { //Pick a random overhead location nextLocationIndex = OverheadLocationIndices[Random.Range(0, OverheadLocationIndices.Count)]; } else if (type == TypeOfPitch.FromSameSource) { //If we don't have a last source, we're the first pitch, otherwise return the last source return(lastSourceIndex > -1 ? lastSourceIndex : nextLocationIndex); } else if (type == TypeOfPitch.FromSpreadSources) { if (lastSourceIndex > -1) { GroundLocationIndices.Remove(lastSourceIndex); } //If we don't have a last source, we're the first pitch, otherwise return the last source nextLocationIndex = GroundLocationIndices[Random.Range(0, GroundLocationIndices.Count)]; if (lastSourceIndex > -1) { GroundLocationIndices.Add(lastSourceIndex); } } return(nextLocationIndex); }
public ChainPitchInfo(int pitchCount = 1, MoneyTypes onlyMoneyTypePitched = MoneyTypes.GoldBar, TypeOfPitch type = TypeOfPitch.FromSameSource, float delayBetweenEachPitch = .5f) { StartDelay = 0; NumberOfPitches = pitchCount; pitchType = type; delayBetweenPitches = new float[NumberOfPitches]; for (int i = 0; i < NumberOfPitches; i++) { delayBetweenPitches[i] = delayBetweenEachPitch; } PitchContents = new MoneyTypes[NumberOfPitches]; for (int i = 0; i < NumberOfPitches; i++) { PitchContents[i] = onlyMoneyTypePitched; } }
public ChainPitchInfo(int pitchCount = 1, float delayBetweenEachPitch = .5f, TypeOfPitch type = TypeOfPitch.FromSameSource, params MoneyTypes[] pitchedMoneyTypes) { StartDelay = 0; NumberOfPitches = pitchCount; delayBetweenPitches = new float[NumberOfPitches]; for (int i = 0; i < NumberOfPitches; i++) { delayBetweenPitches[i] = delayBetweenEachPitch; } PitchContents = new MoneyTypes[NumberOfPitches]; for (int i = 0; i < NumberOfPitches; i++) { if (pitchedMoneyTypes.Length > i) { PitchContents[i] = pitchedMoneyTypes[i]; } else { PitchContents[i] = MoneyTypes.MoneyPack; } } }