コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
 private void CreateFindTargetGoal()
 {
     findTargetGoal       = new AI.FindTargetToAttackHighLevelGoal();
     findTargetGoal.Owner = this.Owner;
 }