示例#1
0
        public string LogForWound(Object sender, HitMethodsEventArgs e)
        {
            if (RoundCount % 2 == 0)
            {
                GameLogs.Items.Add("First player has wounded in the " + FirstPlayer.LastInputBP.ToString()
                                   + " by " + ((int)FirstPlayer.LastInputBP).ToString());
                GameLogs.Items.Add(GetTimeNow() + " - Round has ended");

                Player1HPBox.Text = FirstPlayer.GetPlayerHp() < 0 ? "0" : FirstPlayer.GetPlayerHp().ToString();

                ++RoundCount;
                GameLogs.Items.Add(GetTimeNow() + " - Round " + RoundCount.ToString());
                GameLogs.Items.Add("You attack");

                return(FirstPlayer.GetPlayerName() + FirstPlayer.GetPlayerHp().ToString());
            }
            else
            {
                GameLogs.Items.Add("Second player has wounded in the " + SecondPlayer.LastInputBP.ToString()
                                   + " by " + ((int)SecondPlayer.LastInputBP).ToString());
                GameLogs.Items.Add(GetTimeNow() + " - Round has ended");

                Player2HPBox.Text = SecondPlayer.GetPlayerHp() < 0 ? "0" : SecondPlayer.GetPlayerHp().ToString();

                ++RoundCount;
                GameLogs.Items.Add(GetTimeNow() + " - Round " + RoundCount.ToString());
                GameLogs.Items.Add("You are defending yourself");

                return(SecondPlayer.GetPlayerName() + SecondPlayer.GetPlayerHp().ToString());
            }
        }
示例#2
0
        public string LogForBlock(Object sender, HitMethodsEventArgs e)
        {
            if (RoundCount % 2 == 0)
            {
                GameLogs.Items.Add("First player did blocked hit.");
                GameLogs.Items.Add(GetTimeNow() + " - Round has ended");

                ++RoundCount;
                GameLogs.Items.Add(GetTimeNow() + " - Round " + RoundCount.ToString());
                GameLogs.Items.Add("You attack");

                return(FirstPlayer.GetPlayerName() + FirstPlayer.GetPlayerHp().ToString());
            }
            else
            {
                GameLogs.Items.Add("Second player did blocked hit.");
                GameLogs.Items.Add(GetTimeNow() + " - Round has ended");

                ++RoundCount;
                GameLogs.Items.Add(GetTimeNow() + " - Round " + RoundCount.ToString());
                GameLogs.Items.Add("You are defending yourself");

                return(SecondPlayer.GetPlayerName() + SecondPlayer.GetPlayerHp().ToString());
            }
        }
示例#3
0
        public void GetHit(BodyParts AttackedPart)
        {
            HitMethodsEventArgs args = new HitMethodsEventArgs();

            args.BodyId  = AttackedPart;
            args.TimeHit = DateTime.Now;

            LastInputBP = AttackedPart;

            OnHitMethods(args);
        }
示例#4
0
        public string ProposeRestart(Object sender, HitMethodsEventArgs e)
        {
            RoundCount = 0;

            GameLogs.Items.Clear();

            ButtonHead.Visible  = false;
            ButtonTorso.Visible = false;
            ButtonLegs.Visible  = false;

            HeadOpp.Visible  = false;
            TorsoOpp.Visible = false;
            LegsOpp.Visible  = false;

            return(GetAttackedPlayer());
        }
示例#5
0
        public string LogForDeath(Object sender, HitMethodsEventArgs e)
        {
            if (RoundCount % 2 == 0)
            {
                GameLogs.Items.Add("First player was killed.");
                GameLogs.Items.Add(GetTimeNow() + " - You lose");

                Player1HPBox.Text = FirstPlayer.GetPlayerHp() < 0 ? "0" : FirstPlayer.GetPlayerHp().ToString();

                return(FirstPlayer.GetPlayerName() + FirstPlayer.GetPlayerHp().ToString());
            }
            else
            {
                GameLogs.Items.Add("Second player was killed.");
                GameLogs.Items.Add(GetTimeNow() + " - Congratulations! You won");

                Player2HPBox.Text = SecondPlayer.GetPlayerHp() < 0 ? "0" : SecondPlayer.GetPlayerHp().ToString();

                return(SecondPlayer.GetPlayerName() + SecondPlayer.GetPlayerHp().ToString());
            }
        }
示例#6
0
        protected virtual void OnHitMethods(HitMethodsEventArgs e)
        {
            HitMethodsEventHandler handler;

            if (e.BodyId.Equals(Blocked))
            {
                handler = Block;
            }
            else
            {
                Hp     -= (int)e.BodyId;
                handler = Wound;

                if (Hp <= 0)
                {
                    handler = Death;
                }
            }
            if (handler != null)
            {
                handler(this, e);
            }
        }