public void Awake() { // See if this player is an AI aiLogic = GetComponent <AILogic>(); if (aiLogic != null) { isAI = true; } else // Just in case somehow the initial false set doesn't work { isAI = false; } // On awake, set mana to 0 so that when a turn is activated it can increase the mana CurrentMana = 0; MaxMana = 0; Health = 40; // Set alignment to 0 CurrentAlignment = 0; // Assign players with ID (using find objects as there will only be two player scripts attached) players = GameObject.FindObjectsOfType <Player>(); // Give the players an ID (1 + 2) PlayerID = IDCreator.GetUniqueID(); // set starting health }
// CONSTRUCTOR public CreatureLogic(Player owner, CardTemplate ct) { this.ct = ct; baseHealth = ct.maxHealth; Health = ct.maxHealth; baseAttack = ct.attack; // if the card has bloodthirst, add 1 to the attacks per turn. if (ct.abilityLogic == AbilityLogicList.Bloodthirsty) { attacksForOneTurn = ct.attacksPerTurn + ct.abilityValue; } else { attacksForOneTurn = ct.attacksPerTurn; } // get alignment alignmentValue = ct.alignment; // If the card has the Bravery attribute if (ct.abilityLogic == AbilityLogicList.Bravery) { AttacksLeftThisTurn = attacksForOneTurn; } this.owner = owner; UniqueCreatureID = IDCreator.GetUniqueID(); CreaturesCreatedThisGame.Add(UniqueCreatureID, this); }
// Constructor public CardLogic(CardTemplate ct) { // Set the refs this.ct = ct; // Get unique int ID UniqueCardID = IDCreator.GetUniqueID(); ResetManaCost(); // Add this card to the dictionary with its ID as key CardsCreatedThisGame.Add(UniqueCardID, this); }