public void CheckAdvancedSpells() { canAdvanceSpell = false; List <int> _tempNumbers = new List <int>(); int _spellsRemoved = 0; spellAdvance.beforeMerge = ""; spellAdvance.afterMerge = ""; //if (spellMiniatures.Count > 1) //{ for (int i = 0; i < spellMiniatures.Count; i++) { string _tempString = ""; string _tempComponents = ""; List <SpellCard> _tempList = new List <SpellCard>(); SpellCard _spellCard = spellMiniatures[i].GetComponent <SpellVisuals>().spell; if (_spellCard.advancedSpellComponents.Count == 0) { //Debug.Log(_spellCard.advancedSpellComponents.Count); spellAdvance.beforeMerge += _spellCard.name + " "; SpawnMiniature(_spellCard, false, i); spellAdvance.afterMerge += _spellCard.name + " "; } if (_spellCard.advancedSpellComponents.Count > 0) { if (i + _spellCard.advancedSpellComponents[0].recipeLength < spellMiniatures.Count + 1) { _tempString += _spellCard.name + " "; _tempList.Add(_spellCard); for (int j = 1; j < _spellCard.advancedSpellComponents[0].recipeLength; j++) { _tempList.Add(spellMiniatures[i + j].GetComponent <SpellVisuals>().spell); //spellAdvanceText[j].gameObject.SetActive(true); //spellAdvanceText[j].text = _spellCard.name; _tempComponents += spellMiniatures[i + j].GetComponent <SpellVisuals>().spell.name + " "; _tempString += spellMiniatures[i + j].GetComponent <SpellVisuals>().spell.name + " "; int _number = i + j; _tempNumbers.Add(_number); } if (_tempString == _spellCard.advancedSpellComponents[0].advancedRecipe + " ") { if (spellAdvance.gameObject.activeSelf == false) { spellAdvance.gameObject.SetActive(true); } if (canAdvanceSpell == false) { canAdvanceSpell = true; } spellAdvance.InitialSetup(_spellCard); /*GameObject _spawnedMiniature = objectPooler.SpawnFromPool("CombatMiniature", Vector3.zero, Quaternion.identity, playerScript.playerCanvas.transform); * _spawnedMiniature.transform.localPosition = Vector3.zero; * _spawnedMiniature.transform.localRotation = Quaternion.Euler(Vector3.zero); * SpellVisuals _spawnedMiniatureSpell = _spawnedMiniature.GetComponent<SpellVisuals>(); * _spawnedMiniatureSpell.spell = _spellCard.advancedSpellComponents[0].advancedSpell; * _spawnedMiniatureSpell.LoadSpell(_spellCard.advancedSpellComponents[0].advancedSpell); * cardHolder.spellMiniatures.Add(_spawnedMiniature);*/ SpawnMiniature(_spellCard, true, i); spellAdvance.beforeMerge += _spellCard.name + " "; spellAdvance.beforeMerge += _tempComponents; spellAdvance.whichFlashing.Add(i); foreach (int num in _tempNumbers) { spellAdvance.whichFlashing.Add(num); } spellAdvance.whichFlashingAfter.Add(i - _spellsRemoved); _spellsRemoved += _spellCard.advancedSpellComponents[0].recipeLength - 1; spellAdvance.afterMerge += _spellCard.advancedSpellComponents[0].advancedSpell.name + " "; i += _spellCard.advancedSpellComponents[0].recipeLength - 1; _tempString = ""; foreach (SpellCard s in _tempList) { combatMenu.MoveCardToDestination(s, CardDestination.Hand, CardDestination.Graveyard); } } else { spellAdvance.beforeMerge += _spellCard.name + " "; SpawnMiniature(_spellCard, false, i); spellAdvance.afterMerge += _spellCard.name + " "; } } else { spellAdvance.beforeMerge += _spellCard.name + " "; SpawnMiniature(_spellCard, false, i); spellAdvance.afterMerge += _spellCard.name + " "; } /*if (_spellCard.advancedSpellComponents.Count > 0) * { * * spellAdvance.beforeMerge += _spellCard.name + " "; * Debug.Log(spellAdvance.beforeMerge); * * SpawnMiniature(_spellCard); * * spellAdvance.afterMerge += _spellCard.name + " "; * * }*/ } } //} List <GameObject> _tempMiniatures = new List <GameObject>(); foreach (GameObject sm in spellMiniatures) { _tempMiniatures.Add(sm); } foreach (GameObject sm in _tempMiniatures) { sm.GetComponent <SpellMiniature>().spellSlot.StartCoroutine("LerpMovementBack"); } //spellAdvance.SetSpellNames(); if (canAdvanceSpell == true) { canvasAnim.Play("SpellAdvance"); } else { TurnBarScript.Instance.UnPause(); cardHolder.SetSpellName(); combatMenu.MenuUnPause(); } }
// Update is called once per frame void Update() { if (isPaused == false) { if (isLerping == false) { if (Input.GetButtonDown("MoveUp")) { if ((int)currentTileClass.gridLocation.y + movementRange < bfs.yMax && TileCheck(0, movementRange)) { MovePlayer(MoveDirection.Up); } } else if (Input.GetButtonDown("MoveDown")) { if ((int)currentTileClass.gridLocation.y - movementRange >= 0 && TileCheck(0, -movementRange)) { MovePlayer(MoveDirection.Down); } } else if (Input.GetButtonDown("MoveLeft")) { if ((int)currentTileClass.gridLocation.x - 1 >= 0 && TileCheck(-movementRange, 0)) { MovePlayer(MoveDirection.Left); } } else if (Input.GetButtonDown("MoveRight")) { if ((int)currentTileClass.gridLocation.x + 1 < bfs.xMax && TileCheck(movementRange, 0)) { MovePlayer(MoveDirection.Right); } } #region consoleInput else if (Input.GetAxisRaw("MoveVertical") != 0) { if (vertAxisInUse == false) { if (Input.GetAxisRaw("MoveVertical") < 0) { if ((int)currentTileClass.gridLocation.y - movementRange >= 0 && TileCheck(0, -movementRange)) { MovePlayer(MoveDirection.Down); } } else if (Input.GetAxisRaw("MoveVertical") > 0) { if ((int)currentTileClass.gridLocation.y + movementRange < bfs.yMax && TileCheck(0, movementRange)) { MovePlayer(MoveDirection.Up); } } } } else if (Input.GetAxisRaw("MoveHorizontal") != 0) { if (horizontalAxisInUse == false) { if (Input.GetAxisRaw("MoveHorizontal") < 0) { if ((int)currentTileClass.gridLocation.x - 1 >= 0 && TileCheck(-movementRange, 0)) { MovePlayer(MoveDirection.Left); } } if (Input.GetAxisRaw("MoveHorizontal") > 0) { if ((int)currentTileClass.gridLocation.x + 1 < bfs.xMax && TileCheck(movementRange, 0)) { MovePlayer(MoveDirection.Right); } } } } #endregion ContinuousMovement(); if (Input.GetButton("Shoot")) { shotChargeAmount += Time.deltaTime; if (shotChargeAmount < maxShotChargeTime && shotChargeAmount > 0.05f) { if (chargeParticles[0].isPlaying == false) { chargeParticles[0].Play(); } } else if (shotChargeAmount >= maxShotChargeTime && shotFullyCharged == false) { chargeParticles[0].Stop(); chargeParticles[1].Play(); shotFullyCharged = true; } } if (Input.GetButtonUp("Shoot") && canShoot == true) { canShoot = false; ClearChargeParticles(); if (shotFullyCharged == false) { standardShot.Shoot(spellOrigin[0].transform, gameObject); anim.Play("Attack"); //objectPooler.SpawnFromPool("PlayerBullet", spellOrigin.transform.position, Quaternion.Euler(0, 0, 90), gameObject.transform); } else { //objectPooler.SpawnFromPool("ChargedPlayerBullet", spellOrigin.transform.position, Quaternion.Euler(0, 0, 90), gameObject.transform); ShootCharged(); } shootEvent?.Invoke(); shotChargeAmount = 0; StartCoroutine(ShotDelay()); } if (Input.GetButtonDown("Use")) { if (cardHolder.spellMiniatures.Count > 0) { cardHolder.UseSpell(gameObject, status, spellOrigin[0].transform); anim.Play("Spell"); spellParticles.Play(); } } } if (Input.GetAxisRaw("MoveVertical") == 0) { vertAxisInUse = false; } if (Input.GetAxis("MoveHorizontal") == 0) { horizontalAxisInUse = false; } if (Input.GetButtonUp("StartTurn") && turnBarScript.CurrentTurnTime >= turnBarScript.MaxTurnTime) { if (isPaused == false) { //objectPooler.PauseAll(); CombatMenu _tempCombatMenu = canvasAnim.gameObject.GetComponent <CombatMenu>(); List <SpellCard> _tempSpellList = new List <SpellCard>(); foreach (SpellCard s in _tempCombatMenu.playerCombatInUse) { _tempSpellList.Add(s); } foreach (SpellCard s in _tempSpellList) { _tempCombatMenu.MoveCardToDestination(s, CardDestination.Combat, CardDestination.Graveyard); } cardHolder.Purge(); turnBarScript.Pause(false); canvasAnim.Play("MenuSlideIn"); //EventSystem.current.SetSelectedGameObject(null); //EventSystem.current.SetSelectedGameObject(firstButton); } else { //canvasAnim.Play("MenuSlideOut"); //EventSystem.current.SetSelectedGameObject(null); //objectPooler.UnPauseAll(); } } } }