public void FinishButton() { pathfinding.ClearAllHexes(); turnManager.NextTurn(); turnManager.UpdateCombatUIValues(true); turnManager.HasAttacked = false; }
public void MoveToNewPosition() { MoveCharacter = true; inputManager.ChangeCombatButtonsTo(false); character = turnManager.GetCharacterInTurn(); CalculatePath(); ChangeMovementValues(character); combatAnimationManager.MoveAnimation(character.GetComponent <Animator>(), true); combatAnimationManager.TurnTowardsTarget(character, nextHex); GameObject previousHex = pathfinding.CharacterToHexPosition(character); previousHex.GetComponent <HexProperties>().CharacterInHex = null; nextHex.GetComponent <HexProperties>().CharacterInHex = character; pathfinding.ClearAllHexes(); pathfinding.CharacterToHexPosition(nextHex).GetComponentInChildren <SpriteRenderer>().color = Color.white; //deixa o hex em que o personagem está ,branco inputManager.MoveButtonPressed = false; }
private IEnumerator HighlightHexToSkill() { GameObject currentHex = null; GameObject previousHex = null; GameObject fenrir = turnManager.GetCharacterInTurn(); while (true) { Debug.Log("Ainda"); RaycastHit hit = inputManager.MousePositionToRaycastHit(inputManager.hexLayer); if (hit.collider != null) { if (hit.collider.gameObject.tag == "Hex") { if (hit.collider.gameObject != currentHex) { previousHex = currentHex; currentHex = hit.collider.gameObject; } if (currentHex.GetComponent <HexProperties>().canSkill) { if (currentHex.transform.position.x > fenrir.transform.position.x) { foreach (GameObject hex in hexesToTheRightOfPlayer) { hex.GetComponentInChildren <SpriteRenderer>().color = Color.blue; } } else if (currentHex.transform.position.x < fenrir.transform.position.x) { foreach (GameObject hex in hexesToTheLeftOfPlayer) { hex.GetComponentInChildren <SpriteRenderer>().color = Color.blue; } } if (Input.GetMouseButtonDown(0)) { Debug.Log("Clicou para usar a skill..."); GameObject player = turnManager.GetCharacterInTurn(); Stats playerStats = player.GetComponent <Stats>(); string characterName = playerStats.characterName; if (characterName == "Fenrir") { bool hasEnoughSoulPoints; if (playerStats.currentSoulPoints >= 8) { hasEnoughSoulPoints = true; } else { hasEnoughSoulPoints = false; Debug.Log("Não consegui usar a skill porque: não tenho pontos de alma suficientes"); } bool hasEnoughActionPoints; if (playerStats.currentActionPoints >= 2) { hasEnoughActionPoints = true; } else { hasEnoughActionPoints = false; Debug.Log("Não consegui usar a skill porque: não tenho pontos de ação suficientes"); } if (hasEnoughSoulPoints && hasEnoughActionPoints) { GameObject currentPlayer = turnManager.GetCharacterInTurn(); Stats currentPlayerStats = currentPlayer.GetComponent <Stats>(); if (currentPlayerStats.characterName == "Fenrir") { bool toTheRight = false; if (currentHex.transform.position.x > player.transform.position.x) { toTheRight = true; Debug.Log(toTheRight); DoTheSkill(toTheRight); } else if (currentHex.transform.position.x < player.transform.position.x) { toTheRight = false; Debug.Log(toTheRight); DoTheSkill(toTheRight); } pathfinding.ClearAllHexes(); yield break; } } } else if (characterName == "Hanzo") { Debug.Log("Skill do Hanzo"); } } } else { currentHex.GetComponentInChildren <SpriteRenderer>().color = Color.white; } //if (previousHex != null) //{ // if (previousHex.GetComponent<HexProperties>().canSkill) // { // if (previousHex.transform.position.x > fenrir.transform.position.x) // { // foreach (GameObject hex in hexesToTheRightOfPlayer) // { // hex.GetComponentInChildren<SpriteRenderer>().color = Color.cyan; // } // } // else if (previousHex.transform.position.x < fenrir.transform.position.x) // { // foreach (GameObject hex in hexesToTheLeftOfPlayer) // { // hex.GetComponentInChildren<SpriteRenderer>().color = Color.cyan; // } // } // } // else // { // previousHex.GetComponentInChildren<SpriteRenderer>().color = Color.white; // } //} } } else { if (previousHex != null) { if (previousHex.GetComponent <HexProperties>().canSkill) { if (previousHex.transform.position.x > fenrir.transform.position.x) { foreach (GameObject hex in hexesToTheRightOfPlayer) { hex.GetComponentInChildren <SpriteRenderer>().color = Color.cyan; } } else if (previousHex.transform.position.x < fenrir.transform.position.x) { foreach (GameObject hex in hexesToTheLeftOfPlayer) { hex.GetComponentInChildren <SpriteRenderer>().color = Color.cyan; } } } } } yield return(null); } }
public void MoveButton() { inputManager.MoveButtonPressed = true; pathfinding.ClearAllHexes(); pathfinding.DisplayAvailableHexesToMove(); }