public override void DecideWhatToDo() { bool didRetargetUnit = false; if (PreferAttackingUnits) { didRetargetUnit = FindTargetToAttackHighLevelGoal.TryAssignAttackUnit( replace: false, owner: Owner, allUnits: AllUnits, aggroRadius: 80); } if (!didRetargetUnit) { if (IsInRangeToAttack() == false) { PathfindToTarget(); } else { Owner.TryAttack(TargetBuilding); } } }
private void CreateFindTargetGoal() { findTargetGoal = new AI.FindTargetToAttackHighLevelGoal(); findTargetGoal.Owner = this.Owner; }