public void Attack(CombatTarget combatTarget) { //calls the script for cancelling the action GetComponent <ActionScheduler>().StartAction(this); //player will know weather to attack a target or not target = combatTarget.GetComponent <Health>(); }
public void Attack(CombatTarget combatTarget) { //call action scheduler for cancelling action if neccessary GetComponent <ActionScheduler>().StartAction(this); //store the correct combat target into target variable target = combatTarget.GetComponent <Health>(); }
public bool CanAttack(CombatTarget combatTarget) { if (combatTarget == null) { return(false); } Health targetToTest = combatTarget.GetComponent <Health>(); return(targetToTest != null && !targetToTest.IsDead()); }
private Vector3 GetAimLocation() { CapsuleCollider targetCollider = _target.GetComponent <CapsuleCollider>(); if (targetCollider == null) { return(_target.transform.position); } return(_target.transform.position + Vector3.up * targetCollider.height / 1.7f); }
//ignores dead enimies such as their hit box (checks is they are dead) public bool CanAttack(CombatTarget combatTarget) { //if we click on the terrain instead of target return false if (combatTarget == null) { return(false); } Health targetToTest = combatTarget.GetComponent <Health>(); return(targetToTest != null && !targetToTest.IsDead()); }
//function to check if the enemy that was hit by raycast is targetable public bool CanAttack(CombatTarget combatTarget) { //if the combatTarget passed in is null then return false (we cannot attack a null object) if (combatTarget == null) { return(false); } //get Health component from the passed combatTarget Health targetToTest = combatTarget.GetComponent <Health>(); //return true if target is not null AND target is not dead return(targetToTest != null && !targetToTest.IsDead()); }
public void Attack(CombatTarget combatTarget) { GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.GetComponent <Health>(); }
public bool CanAttack(CombatTarget combatTarget) { return(attackableAlignments.Contains(combatTarget.Alignment) && combatTarget.GetComponent <Health>().Alive); }