public BattlePokemon( string name, string?nickname, int level, IPermanentStat health, IPermanentStat attack, IPermanentStat defense, IPermanentStat special, IPermanentStat speed, IBattleStat accuracy, IBattleStat evasion, decimal weight, decimal height, IReadOnlyIndexedSet <IType> types, IReadOnlyIndexedSet <IMove> moves, ITier tier) { Name = name; Nickname = nickname; Level = level; Health = health; Attack = attack; Defense = defense; Special = special; Speed = speed; Accuracy = accuracy; Evasion = evasion; Weight = weight; Height = height; Types = types; Moves = moves; Tier = tier; }
public Species( int id, string name, ISpeciesStat health, ISpeciesStat attack, ISpeciesStat defense, ISpeciesStat special, ISpeciesStat speed, decimal weight, decimal height, IReadOnlyIndexedSet <IType> types, IReadOnlyIndexedSet <IMove> moves, ITier tier) { Id = id; Name = name; Health = health; Attack = attack; Defense = defense; Special = special; Speed = speed; Weight = weight; Height = height; Types = types; Moves = moves; Tier = tier; }
static void Main(string[] args) { ITier[] tiersammlung = new ITier[3]; tiersammlung[0] = new Löwe(10, "Weibchen"); tiersammlung[1] = new Hund(8, "Männchen"); tiersammlung[2] = new Hund(5, "Weibchen"); foreach (var tier in tiersammlung) { if (tier is Löwe) { Console.WriteLine("Der Löwe ist " + tier.Alter + " Jahre alt und ein " + tier.Geschlecht + "."); } else if (tier is Hund) { Console.WriteLine("Der Hund ist " + tier.Alter + " Jahre alt und ein " + tier.Geschlecht + "."); } } }
static void Main(string[] args) { ITier[] tierSammlung = new ITier[3]; tierSammlung[0] = new Löwe(10, "Weibchen"); tierSammlung[1] = new Haushund(2, "Männchen"); tierSammlung[2] = new Haushund(5, "Weibchen"); //ausgabe foreach (ITier tier in tierSammlung) // für jedes tier in tiersammlung { // typ überprüfen if (tier is Löwe) { Console.WriteLine("Das Löwe ist {0} und ein {1}", tier.Alter, tier.Geschlecht); } else if (tier is Haushund) { Console.WriteLine("Das Haushund ist {0} und ein {1}", tier.Alter, tier.Geschlecht); } Console.ReadKey(); } }