private void Start() { card = Instantiate(entityCardPrefab); card.transform.SetParent(Canvas2D.Instance.transform, false); card.gameObject.SetActive(false); selectionManager.OnSelectionUpdated += OnSelectionUpdated; }
/// <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); }
/// <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(); } }
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; }
int UnitCardValue(EntityCard card) { return card.Attack + card.Health/2 + card.Movement/2; }
public override void FromCard(EntityCard card) { Model = (GameObject) Instantiate((GameObject) Resources.Load(prefabString)); Model.transform.parent = transform; }
public override void FromCard(EntityCard card) { Model = (GameObject) Instantiate(Assets.Instance.Flag); Model.transform.parent = transform; }
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; }
int EntityCardValue(EntityCard card) { return card.Value(); }