コード例 #1
0
        public override float Utility(HT a)
        {
            if (sPoint != null)
            {
                if ((a.pos - sPoint.pos).magnitude < a.targetProximity)
                {
                    // We're close enough, so lose this sPoint
                    sPoint = null;
                }
            }

            if (sPoint == null)
            {
                // Choose a random SpawnPoint of the item type
                sPoint = a.RandomSP();
            }

            // Return the maximum wander utility
            uRec.dest = sPoint.pos;
            uRec.u    = 1;

            // The last line of ALL of these needs to be return base.Utility(a)
            //   because base.Utility(a) applies both the curve and the utilMinMax limits
            return(base.Utility(a));
        }