public override void Execute(float d) { if (Input.GetMouseButtonDown(0)) { List <RaycastResult> results = Settings.GetUIObjects(); foreach (RaycastResult result in results) { CardInstance cardInst = result.gameObject.GetComponentInParent <CardInstance>(); PlayerHolder player = Settings.gameManager.currentPlayer; if (player.cardsOnTable.Contains(cardInst)) { if (cardInst.CanAttack()) { player.attackingCards.Add(cardInst); player.currentHolders.SetCardOnBattleLine(cardInst); } } else { return; } } } }
public override void Excute(float dt) { if (Input.GetMouseButtonDown(0)) { List <RaycastResult> results = Settings.GetUIObjs(); foreach (RaycastResult r in results) { CardInstance inst = r.gameObject.GetComponentInParent <CardInstance>(); PlayerHolder p = Settings.gameManager.currentPlayer; if (!p.cardsDown.Contains(inst)) { return; } if (inst.CanAttack() && !p.attackingCards.Contains(inst)) { //Debug.Log("Add Card Attack:" + inst.name); p.attackingCards.Add(inst); p.currentHolder.SetCardOnBattleLine(inst); } } } }
public override void Execute(float d) { if (Input.GetMouseButtonDown(0)) { var results = Settings.GetUIObjects(); foreach (RaycastResult result in results) { CardInstance instance = result.gameObject.GetComponentInParent <CardInstance>(); PlayerHolder player = Settings._gameManager.currentPlayer; if (!player.cardsDownMelee.Contains(instance) || !player.cardsDownRanged.Contains(instance)) { return; } if (instance.CanAttack()) { player.attackingCards.Add(instance); // you can attack } } } }