public bool interactWithCell(Cell c) { //Debug.Log("Han intentado interactuar conmigo"); if (this.selectedCharacter == null) { if (c.hoverCharacter != null && c.hoverCharacter.owner == actualPlayer) { Debug.Log("Me han seleccionado"); this.selectedCharacter = c.hoverCharacter; } } else { if (c.hoverCharacter == null && this.selectedCharacter.CanMove(c)) { Debug.Log("Me he movido"); if (selectedCharacter.GetType() == typeof(King)) { if (selectedCharacter.ManhattanDistance(c) > 1f) { return(false); } } this.selectedCharacter.Move(c); } else if (c.hoverCharacter != null) { if (c.hoverCharacter == this.selectedCharacter) { Debug.Log("Me han deseleccionado"); this.selectedCharacter = null; } else if (c.hoverCharacter.owner == null) { Debug.Log("Sóc l'excalibur!"); if (this.selectedCharacter is King) { King k = (King)this.selectedCharacter; if (k.CanGetSword(c)) { Debug.Log("El rey cogió el excalibur"); k.GetSword(c); return(true); } } } else if (c.hoverCharacter.owner == actualPlayer) { this.selectedCharacter = c.hoverCharacter; } else if (c.hoverCharacter.owner != actualPlayer) { Debug.Log("Soy un enemigo!"); if (this.selectedCharacter.CanAttack(c)) { Debug.Log("He atacado!"); this.selectedCharacter.Attack(c); if (c.hoverCharacter is King && c.hoverCharacter.currentHealth <= 0) { return(true); } } } } } return(false); }