Exemplo n.º 1
0
Arquivo: One.cs Projeto: AM636E/dotNet
        public void Beat( Unit target )
        {
            Console.WriteLine( this.name + " beat " + target.Name + " and redused his life to " + target.Life;

            target.GetKick( this.power );

            if( target.Life <= 0 )
            {
                target.Die( );
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            Unit[] a = new Unit[100];

            for (var i = 0; i < 100; i += 4)
            {
                a[i] = new HKing();
                a[i + 1] = new HWarrior();
                a[i + 2] = new AKing();
                a[i + 3] = new AWarrior();
            }

            for (var i = 0; i < 100; i++)
            {
                for (var j = 0; j < 100; j++)
                {
                    a[i].Beat(a[j]);
                    Console.ReadKey();
                }
            }
        }
Exemplo n.º 3
0
        public void Beat( Unit target )
        {
            Console.Write( this.name + " \a attacked " + target.Name  );
            if (!this.isDied && (this.Sighn != target.Sighn))
            {
                target.GetKick(this.power);

                if (target.Life <= 0)
                {
                    target.Die();
                }
                else
                {
                    Console.WriteLine(" and redused his life to " + target.Life);
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(" but This is a friend");
                Console.ResetColor();
            }
        }