コード例 #1
0
        public void Attack(int value)
        {
            var punch    = (TypeOfPunches)value;
            int strength = Strength[punch];

            PunchingBoxer  = false;
            Punch          = punch;
            ChangeHitpoits = false;
            BoxingEvent?.Invoke(strength, punch);
        }
コード例 #2
0
        public void Defence(int value, TypeOfPunches type)
        {
            PunchingBoxer = true;
            var punch   = type;
            int agility = Agility[punch];
            var nett    = value - agility;

            if (nett > 0)
            {
                ChangeHitpoits = true;
                Hitpoints     -= nett;
            }
            else if (nett <= 0)
            {
                ChangeHitpoits = false;
            }


            if (Hitpoints <= 0)
            {
                KnockedOut = true;
            }
        }