예제 #1
0
        internal void RefreshData()
        {
            if (!isSilent && changeIsSilent)
            {
                isSilent = true;

                changeIsSilent = false;
            }

            if (changeDamage != 0)
            {
                damage += changeDamage;

                changeDamage = 0;
            }

            if (changeMaxHp != 0)
            {
                nowHp += changeMaxHp;

                maxHp += changeMaxHp;

                changeMaxHp = 0;
            }

            if (changeHp != 0)
            {
                nowHp += changeHp;

                changeHp = 0;

                if (nowHp < 0)
                {
                    nowHp = 0;
                }
                else if (nowHp > maxHp)
                {
                    nowHp = maxHp;
                }
            }

            if (changePower != 0)
            {
                nowPower += changePower;

                changePower = 0;

                if (nowPower < 0)
                {
                    nowPower = 0;
                }
                else if (nowPower > sds.GetPower())
                {
                    nowPower = sds.GetPower();
                }
            }
        }
예제 #2
0
        internal Hero(Battle _battle, bool _isMine, IHeroSDS _sds, int _pos, int _uid)
        {
            eventListenerV = _battle.eventListenerV;

            isMine = _isMine;

            sds = _sds;

            PosChange(_pos);

            uid = _uid;

            nowHp = sds.GetHp();

            nowPower = sds.GetPower();

            action = HeroAction.NULL;

            if (sds.GetSkills().Length > 0)
            {
                HeroSkill.Init(_battle, this);
            }

            if (sds.GetAuras().Length > 0)
            {
                HeroAura.Init(_battle, this);
            }
        }
예제 #3
0
파일: Hero.cs 프로젝트: ludidilu/HexWar_lib
        public Hero(bool _isMine, int _id, IHeroSDS _sds, int _pos)
        {
            isMine   = _isMine;
            id       = _id;
            sds      = _sds;
            pos      = _pos;
            nowHp    = sds.GetHp();
            nowPower = sds.GetPower();

            canMove  = false;
            isSummon = true;
        }
예제 #4
0
        internal Hero(bool _isMine, IHeroSDS _sds, int _pos)
        {
            isMine = _isMine;

            sds = _sds;

            PosChange(_pos);

            nowHp = sds.GetHp();

            nowPower = sds.GetPower();

            action = HeroAction.NULL;
        }
예제 #5
0
        public Hero2(Battle2 _battle, int _uid, bool _isMine, int _id, IHeroSDS _sds, int _pos)
        {
            battle = _battle;

            uid = _uid;

            isMine   = _isMine;
            id       = _id;
            sds      = _sds;
            pos      = _pos;
            maxHp    = nowHp = sds.GetHp();
            damage   = sds.GetDamage();
            nowPower = sds.GetPower();

            //isMoved = false;

            isSummon = !sds.GetHeroTypeSDS().GetCanCharge();

            eventIndexList = new List <int>();

            for (int i = 0; i < sds.GetSkills().Length; i++)
            {
                ISkillSDS skillSDS = Battle2.skillDataDic[sds.GetSkills()[i]];

                int index = i;

                Action <SuperEvent> del = delegate(SuperEvent e)
                {
                    CastSkill(index, e);
                };

                switch (skillSDS.GetTrigger())
                {
                case SkillTrigger.ALL:

                    int eventIndex = battle.superEventListener.AddListener(skillSDS.GetEventName().ToString(), del);

                    eventIndexList.Add(eventIndex);

                    break;

                case SkillTrigger.HERO:

                    eventIndex = battle.superEventListener.AddListener(string.Format("{0}{1}", skillSDS.GetEventName(), uid), del);

                    eventIndexList.Add(eventIndex);

                    break;

                case SkillTrigger.ALLY:

                    eventIndex = battle.superEventListener.AddListener(string.Format("{0}{1}", skillSDS.GetEventName(), isMine), del);

                    eventIndexList.Add(eventIndex);

                    break;

                case SkillTrigger.ENEMY:

                    eventIndex = battle.superEventListener.AddListener(string.Format("{0}{1}", skillSDS.GetEventName(), !isMine), del);

                    eventIndexList.Add(eventIndex);

                    break;
                }
            }
        }