void SpawnCircle() { spawnCircle = false; GameObject markerObject = Instantiate(circleMark, new Vector3(transform.position.x, -0.5f, transform.position.z), Quaternion.identity); markerObject.GetComponent <Transform>().localEulerAngles = new Vector3(90, 0, 0); OnFinishPanning onFinishPanning = () => { //mTouchManager.canShoot = true; gameManagerScript.ChangeTurn(); }; cameraManager.LookOtherCamera(onFinishPanning, gameManagerScript.GetCurrentTurn()); //cameraMain.SetActive(false); }
private void FixedUpdate() { if (game.go == true) { if (game.Turn == 0) { Battle(); if (go == true) { but.interactable = true; LightIndicator.color = new Color(1, 1, 1, 0.2f); if (click == 1) { if (Specialization == 1 && BattleCard.Specialization == 3 || Specialization == 2 && BattleCard.Specialization == 1 || Specialization == 3 && BattleCard.Specialization == 2) { SpecCard(); } else if (Specialization == 4 && Race < 4) { AssassinCard(); } else if (Race == 4) { MegaCard(2); } else if (Race == 5) { MegaCard(4); } else if (Specialization < 4 && Race < 4) { game.HotCard = 0; Sound.AttackSound(); } BattleCard.BattleImage.sprite = CardImage.sprite; BattleCard.BattleImage.color = new Color(1, 1, 1, 1); BattleCard.Race = Race; BattleCard.Specialization = Specialization; BattleCard.ForceCard = ForceCard; if (Specialization != 4) { game.ChangeTurn(); } for (int i = 0; i < game.CurrentGame.PlayerHand.Count; i++) { if (CardImage.sprite == game.CurrentGame.PlayerHand[i].Logo) { game.CurrentGame.PlayerHand.RemoveAt(i); break; } } Destroy(gameObject); } } else { LightIndicator.color = new Color(1, 1, 1, 0); but.interactable = false; } } else { go = false; LightIndicator.color = new Color(1, 1, 1, 0); but.interactable = false; FreeCard.transform.SetParent(DefaultParent.parent); FreeCard.transform.localPosition = TransFree; } } }
IEnumerator EnemyTurn(List <CardControllerScript> cards) { yield return(new WaitForSeconds(1)); GameManagerScript gameManager = GameManagerScript.instance; int count = Random.Range(0, cards.Count + 1); for (int i = 0; i < count; i++) //выставление карт соперником для проверки { if (gameManager.enemyFieldCards.Count > 4 || GameManagerScript.instance.enemyEnergy == 0 || gameManager.enemyHandCards.Count == 0) { break; } List <CardControllerScript> cardsList = cards.FindAll(x => gameManager.enemyEnergy >= x.thisCard.cost && !x.thisCard.isSpell); //карты с подходящей ценой в руке if (cardsList.Count == 0) { break; } cardsList[0].GetComponent <CardMovementScript>().MoveToField(gameManager.enemyField); yield return(new WaitForSeconds(0.51f)); cardsList[0].transform.SetParent(gameManager.enemyField); cardsList[0].OnCast(); } yield return(new WaitForSeconds(1)); while (gameManager.enemyFieldCards.Exists(x => x.thisCard.canAttack)) // атака соперником для проверки { var activeCard = gameManager.enemyFieldCards.FindAll(x => x.thisCard.canAttack)[0]; bool hasProvocation = gameManager.playerFieldCards.Exists(x => x.thisCard.isProvocation); if (hasProvocation || Random.Range(0, 2) == 0 && gameManager.playerFieldCards.Count > 0) { CardControllerScript enemy; if (hasProvocation) { enemy = gameManager.playerFieldCards.Find(x => x.thisCard.isProvocation); } else { enemy = gameManager.playerFieldCards[Random.Range(0, gameManager.playerFieldCards.Count)]; } //Debug.Log(activeCard.SelfCard.Name); activeCard.thisCard.canAttack = false; activeCard.movement.MoveToTurget(enemy.transform); yield return(new WaitForSeconds(.2f)); gameManager.CardsFight(enemy, activeCard); } else { activeCard.thisCard.canAttack = false; activeCard.GetComponent <CardMovementScript>().MoveToTurget(gameManager.playerHero.transform); yield return(new WaitForSeconds(.2f)); gameManager.DamageHero(activeCard, false); } yield return(new WaitForSeconds(1)); } yield return(new WaitForSeconds(1)); gameManager.ChangeTurn(); }