Exemple #1
0
        public void Run()
        {
            // set behavior from state (hostile or neutral)
            // only outputs text
            a.SetBehavior(MonsterState.Neutral, new NeutralBehavior());

            // change state (hostile or neutral
            // only matters if attacking or getting attacked
            a.SetState(MonsterState.Hostile);

            // acts out with behavior from state (hostile = grrr, neutral = hello)
            a.Act();
            b.Act();

            // attack test
            a.Attack(a, b);

            Console.WriteLine("Current direction");
            Console.WriteLine(a.Direction);
            Console.WriteLine();
            Console.WriteLine("New direction");
            a.Direction = CreatureMovement();
            Console.WriteLine(a.Direction);

            Console.WriteLine();

            // factory test
            Console.WriteLine("Testing weapon factory");
            TestWeaponFactory(new WeaponFactory());

            Console.WriteLine();

            // factory test
            Console.WriteLine("Testing armor factory");
            TestArmorFactory(new ArmorFactory());
        }