private void Start()
    {
        card = Instantiate(entityCardPrefab);
        card.transform.SetParent(Canvas2D.Instance.transform, false);
        card.gameObject.SetActive(false);

        selectionManager.OnSelectionUpdated += OnSelectionUpdated;
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Создать рандомную колоду
        /// </summary>
        private (string, List <EntityCard>) CreateRandomDeck(SerializedDeck serializedDeck)
        {
            var resultDeck = new List <EntityCard>();

            foreach (var serializedCard in serializedDeck.Cards)
            {
                var card = new EntityCard(serializedCard, serializedDeck.IsCustomDeck);
                resultDeck.Add(card);
            }

            return(serializedDeck.HeroLogoPath, resultDeck);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Инициализация контроллера
        /// </summary>
        /// <param name="card">Карта</param>
        /// <param name="playerType">Тип игрока, которому принадлежит карта</param>
        public void Init(EntityCard card, PlayerType playerType)
        {
            Card       = card;
            PlayerType = playerType;

            if (playerType == PlayerType.Player)
            {
                Info.ShowCardInfo();
            }
            else
            {
                Info.HideCardInfo();
            }
        }
Ejemplo n.º 4
0
 public virtual void FromCard(EntityCard card)
 {
     Card = card;
     Model = (GameObject) Instantiate(card.Prefab, new Vector3(transform.position.x+card.Prefab.transform.position.x, transform.position.y+card.Prefab.transform.position.y,transform.position.z+card.Prefab.transform.position.z), card.Prefab.transform.localRotation);
     Model.transform.parent = transform;
     Attack = card.Attack;
     MaxHealth = card.Health;
     MaxMovement = card.Movement;
     UnitName = card.Name;
     ProjectilePrefab = card.ProjectilePrefab;
 }
Ejemplo n.º 5
0
 int UnitCardValue(EntityCard card)
 {
     return card.Attack + card.Health/2 + card.Movement/2;
 }
Ejemplo n.º 6
0
 public override void FromCard(EntityCard card)
 {
     Model = (GameObject) Instantiate((GameObject) Resources.Load(prefabString));
     Model.transform.parent = transform;
 }
Ejemplo n.º 7
0
 public override void FromCard(EntityCard card)
 {
     Model = (GameObject) Instantiate(Assets.Instance.Flag);
     Model.transform.parent = transform;
 }
Ejemplo n.º 8
0
    bool PlayEntityCard(EntityCard card)
    {
        Hex targetHex = null;

        player.SetTargetsForCard(card);
        if(player.targets.Count < 1) {
            return false;
        }

        foreach(Hex hex in player.targets) {
            if(targetHex == null) {
                targetHex = hex;
            } else {
                if(CalculateHexValue(hex) > CalculateHexValue(targetHex)) {
                    targetHex = hex;
                }
            }
        }

        // Play card
        gameControl.EnemyCardPlayed(card);
        gameControl.PlayCardOnHex(card, targetHex, System.Guid.NewGuid().ToString());
        player.SpendMana(card.Cost);
        player.Hand.Remove(card);
        return true;
    }
Ejemplo n.º 9
0
 int EntityCardValue(EntityCard card)
 {
     return card.Value();
 }