Пример #1
0
        public BattleCard(TroopMember member)
        {
            m_CardData            = new CardData();
            m_CardData.CardGuid   = member.guid;
            m_CardData.CardTempId = member.cardID;
            m_CardData.TotalHp    = member.initHp;
            m_CardData.MemberData = member;
            m_CurrentHp           = member.initHp;

            if (member.state == 1)
            {
                m_IsDead = true;
            }

            if (0 <= member.slotIndex && member.slotIndex <= 5)
            {
                m_CardType   = BattleCardType.E_BATTLE_CARD_TYPE_SELF;
                m_BattleSlot = BattleCardManager.Instance.BattleSlotArray[BattleCardType.E_BATTLE_CARD_TYPE_SELF][member.slotIndex];
            }
            else
            {
                m_CardType   = BattleCardType.E_BATTLE_CARD_TYPE_OTHER;
                m_BattleSlot = BattleCardManager.Instance.BattleSlotArray[BattleCardType.E_BATTLE_CARD_TYPE_OTHER][member.slotIndex - 6];
            }
            m_BattleSlot.SetCard(this);
            m_BattleSlot.SetTotalHp(member.initHp);
            m_BattleSlot.SetCurHp(member.initHp);

            m_StateMachine = new CardStateMachine(this);
        }
        public virtual bool Init(CardStateMachine machine)
        {
            m_StateMachine = machine;
            m_BattleCard   = machine.Owner;

            return(true);
        }