public override void Interact() { base.Interact(); CharCombat playerCombat = playerManager.player.GetComponent <CharCombat>(); if (playerCombat != null) { playerCombat.Attack(myStats); Debug.Log("you are attacking the enemy"); } }
public void Attack(Dist dist, CharCombat other) { currentAttack = null; if (dist == Dist.CLOSE) { currentAttack = closeAttack; } else if (dist == Dist.MEDIUM) { currentAttack = mediumAttack; } else if (dist == Dist.FAR) { currentAttack = farAttack; } other.health -= CalculateDamageFromAttack(currentAttack); Debug.Log(name + " has attacked with " + currentAttack.name + ". " + other.name + " has received " + currentAttack.damage + " damage."); turnIsFinished = true; Debug.Log("Turn finished for " + name); }
void Start() { target = PlayerManager.instance.player.transform; //put it on the player manager so it can be saved between scenes agent = GetComponent <NavMeshAgent>(); combat = GetComponent <CharCombat>(); }