public void Attack(Destructible target) { if (attack_enabled && target != null && target != destruct && target.CanBeAttacked()) { this.target = target.gameObject; this.attack_target = target; this.attack_player = null; move_target = target.transform.position; is_escaping = false; is_moving = true; move_timer = 0f; direct_move = false; CalculateNavmesh(); } }
//Can it be attacked at all? public bool CanAttack(Destructible target) { return(can_attack && target != null && target.CanBeAttacked() && (target.required_item != null || target.attack_group != AttackGroup.Ally) && //Cant attack allied unless has required item (target.required_item == null || character.EquipData.HasItemInGroup(target.required_item))); //Cannot attack unless has equipped item }