示例#1
0
        //Methods
        public void ApplySpell(PlayCard _card)
        {
            switch (_spellType)
            {
            case (SpellTypes.Ice):
                if (_card.CFaction == this.CFaction)
                {
                    _card.Health += _power;
                }
                else
                {
                    _card.Health -= _power;
                }
                break;

            case (SpellTypes.Fire):
                if (_card.CFaction == this.CFaction)
                {
                    _card.AttackTop    += _power;
                    _card.AttackRight  += _power;
                    _card.AttackLeft   += _power;
                    _card.AttackBottom += _power;
                }
                else
                {
                    _card.AttackTop    -= _power;
                    _card.AttackRight  -= _power;
                    _card.AttackLeft   -= _power;
                    _card.AttackBottom -= _power;
                }
                break;
            }
        }
示例#2
0
        void Start()
        {
            Hands = GameObject.FindGameObjectsWithTag("Hand");

            cardInventory = ScriptableObject.CreateInstance <CardsList>();

            if (!File.Exists(Application.dataPath + "/Resources/MyCards/CardsInventory.json"))
            {
                return;
            }

//			_jsonString = File.ReadAllText(Application.dataPath + "/Resources/MyCards/CardsInventory.json").ToString();

            _myCardsJson = JsonMapper.ToObject(_jsonString);

            if (_myCardsJson.Count == 0)
            {
                return;
            }

            for (int i = 0; i < _myCardsJson.Count; i++)
            {
                _myCard = new PlayCard((int)_myCardsJson[i]["Health"], (int)_myCardsJson[i]["AttackTop"], (int)_myCardsJson[i]["AttackBottom"],
                                       (int)_myCardsJson[i]["AttackLeft"], (int)_myCardsJson[i]["AttackRight"], (int)_myCardsJson[i]["GemSlotsCount"], (int)_myCardsJson[i]["Hand"],
                                       (int)_myCardsJson[i]["CID"], (int)_myCardsJson[i]["CFaction"], _myCardsJson[i]["CName"].ToString(), _myCardsJson[i]["CDesc"].ToString(),
                                       (int)_myCardsJson[i]["CPieces"], (int)_myCardsJson[i]["CLevel"]);
                cardInventory.AddNewCard(_myCard);
            }

            foreach (GameObject hand in Hands)
            {
                hand.GetComponent <CreateCards>().CreateSomeCards(cardInventory);
            }
        }
示例#3
0
        public void AddNewCard(PlayCard item)
        {
            int _id = -1;

            foreach (PlayCard c in hand)
            {
                if (c.CID > _id)
                {
                    _id = c.CID;
                }
            }
            item.CID = _id + 1;
            hand.Add(item);
        }
示例#4
0
        //this is a constructor that is accepting an object of type
        //PlayCard and make the current object a clone of this object
        public PlayCard Copy(PlayCard PlayC)
        {
            PlayC.CID           = this.CID;
            PlayC.CFaction      = this.CFaction;
            PlayC.CName         = this.CName;
            PlayC.CDesc         = this.CDesc;
            PlayC.CPieces       = this.CPieces;
            PlayC.CLevel        = this.CLevel;
            PlayC.Health        = this.Health;
            PlayC.AttackTop     = this.AttackTop;
            PlayC.AttackBottom  = this.AttackBottom;
            PlayC.AttackLeft    = this.AttackLeft;
            PlayC.AttackRight   = this.AttackRight;
            PlayC.GemSlotsCount = this.GemSlotsCount;
            PlayC._gemSlots     = this._gemSlots;
            PlayC._hand         = this._hand;

            return(PlayC);
        }
示例#5
0
 void Awake()
 {
     _myCard = new PlayCard();
 }
示例#6
0
 public void RemoveCard(PlayCard item)
 {
     PCDB.Remove(item);
 }