Created Generations Class
Added Generations to track the generations of Poke`mon, and pick random based upon unlocked level of Generation.
This commit is contained in:
parent
09c99b6cf5
commit
8f1d66da1b
1 changed files with 30 additions and 0 deletions
30
Library/Singletons/Generations.cs
Normal file
30
Library/Singletons/Generations.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace PokePurple.Library.Singletons;
|
||||||
|
|
||||||
|
public class Generations
|
||||||
|
{
|
||||||
|
private List<Range> _generations =
|
||||||
|
[
|
||||||
|
new Range(1,151),
|
||||||
|
new Range(152, 251),
|
||||||
|
new Range(252, 386),
|
||||||
|
new Range(387, 493),
|
||||||
|
new Range(494, 649),
|
||||||
|
new Range(650, 721),
|
||||||
|
new Range(722, 809),
|
||||||
|
new Range(810, 905),
|
||||||
|
new Range(906, 1025)
|
||||||
|
];
|
||||||
|
|
||||||
|
public int Generation = 1;
|
||||||
|
|
||||||
|
public int PickRandomPokemon()
|
||||||
|
{
|
||||||
|
var maxRange = _generations[Generation].End.Value;
|
||||||
|
var random = new Random();
|
||||||
|
var id = random.Next(1, maxRange);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue