Hero.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace MyGame
{

    /// <summary>
    /// MyGame中的玩家类
    /// </summary>
    public class Hero
    {
        public Hero() { }
        public Hero(string heroName, int originalBlood, int attackPower, int defendPower,
            Image image, Weapon weapon, Point originalLocation, Size size,Image deadImage)
        {
            this.heroName = heroName;
            this.originalBlood = originalBlood;
            this.currentBlood = originalBlood;
            this.attackPower = attackPower;
            this.defendPower = defendPower;
            this.image = image;
            this.Weapon = weapon;
            this.originalLocation = originalLocation;
            this.currentLocation = originalLocation;
            this.size = size;
            this.deadImage = deadImage;
        }

        private Image deadImage;

        #region 属性
        //主角名字
        private string heroName;
        public string HeroName
        {
            get { return heroName; }
            set { heroName = value; }
        }
        //生命值
        private int originalBlood;
        public int OriginalBlood
        {
            get { return originalBlood; }
            set { originalBlood = value; }
        }
        //当前生命值
        private int currentBlood;
        public int CurrentBlood
        {
            get { return currentBlood; }
            set 
            {
                //如果当前生命小于等于0
                if (value <= 0)
                {
                    //设定死亡图片和生命值
                    currentBlood = 0;
                    this.Image = this.deadImage;
后面还有 109 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。