Beispiel #1
0
        static Ninja CreateNinja(int piratesKilled, Clothing? clothes)
        {
            Ninja ninja = new Ninja();
            ninja.Name = "Sarutobi Sasuke";
            Weapon katana = new Weapon(WeaponType.Katana);
            Weapon shuriken = new Weapon(WeaponType.Shuriken);
            Weapon bow = new Weapon(WeaponType.Bow);
            List<Weapon> weapons = new List<Weapon>();
            weapons.Add(katana);
            weapons.Add(shuriken);
            weapons.Add(bow);
            ninja.Weapons = weapons;

            if (piratesKilled < 1)
            {
                ninja.PiratesKilled = 1;
            }
            else
            {
                ninja.PiratesKilled = piratesKilled;
            }

            if (clothes.HasValue)
            {
                ninja.Clothes = clothes.Value;
            }
            else
            {
                ninja.Clothes = Clothing.Shozoku;
            }

            return ninja;
        }
Beispiel #2
0
        public void AddNinja(Ninja ninja)
        {
            if (ninjas.Count > 4)
            {
                throw new Exception("The clan cannot hold more ninjas.");
            }

            ninjas.Add(ninja);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Ninjas!!!");

            Person ninja = new Person("Mr.", "Nibbles");
            Person benny = new Person("Benny Bob", "McBob", 55);

            Ninja lydell = new Ninja("Lydell", "Ninja", 100, 150, 200);

            lydell.Birthday();


            benny.Birthday().Birthday().Birthday();
            Console.WriteLine(benny.Age);
        }
Beispiel #4
0
        public Clan WithNinja(Ninja ninja)
        {
            this.ninjas.Add(ninja);

            return this;
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Ninja ninja = CreateNinja(0, null);

            WriteNakedNinjas();
        }
Beispiel #6
0
        public Clan WithNinja(Ninja ninja)
        {
            this.ninjas.Add(ninja);

            return(this);
        }