private void SelectNode(FightNode fightNode) { if (fightNode.currentNodeOwner == NodeOwner.Player && isClicking) { if (attackingNode == null) { fightNode.Select(true); attackingNode = fightNode; } } if (attackingNode != null && fightNode != attackingNode && isClicking) { if (attackedNode != null) { attackedNode.Select(false); } fightNode.Select(true); attackedNode = fightNode; } }
private void MouseButtonUp() { if (attackingNode != null && attackedNode != null) { var attackUnitsCount = attackingNode.SendAttackGroup(); for (int i = 0; i < attackUnitsCount; i++) { var spawnPos = attackingNode.transform.position + (Vector3)Random.insideUnitCircle; spawnPos.z = 0f; AttackUnit attackUnit = Instantiate(attackUnitPrefab, spawnPos, Quaternion.identity); attackUnit.SetAim(attackedNode); } int attackingIndex = 0; int attackedIndex = 0; for (int i = 0; i < FightNode.fightNodes.Count; i++) { if (attackingNode == FightNode.fightNodes[i]) { attackingIndex = i; } if (attackedNode == FightNode.fightNodes[i]) { attackedIndex = i; } } actionsSequence.Add(attackingIndex); actionsSequence.Add(attackedIndex); } if (attackingNode != null) { attackingNode.Select(false); attackingNode = null; } if (attackedNode != null) { attackedNode.Select(false); attackedNode = null; } connectionLine.gameObject.SetActive(false); }