public override float Score(IAIContext context, BasePlayer option)
        {
            Vector3             vector3;
            float               single;
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;

            if (playerTargetContext == null || !BestPlayerDirection.Evaluate(playerTargetContext.Self, option.ServerPosition, out vector3, out single))
            {
                playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.zero;
                playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = -1f;
                return(0f);
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = vector3;
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = single;
            return((single + 1f) * 0.5f * this.score);
        }
Example #2
0
        public virtual float Score(IAIContext context, BasePlayer option)
        {
            PlayerTargetContext playerTargetContext = context as PlayerTargetContext;
            Vector3             dir;
            float dot;

            if (playerTargetContext != null && BestPlayerDirection.Evaluate(playerTargetContext.Self, option.ServerPosition, out dir, out dot))
            {
                playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = dir;
                playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = dot;
                return((float)(((double)dot + 1.0) * 0.5) * this.score);
            }
            playerTargetContext.Direction[playerTargetContext.CurrentOptionsIndex] = Vector3.get_zero();
            playerTargetContext.Dot[playerTargetContext.CurrentOptionsIndex]       = -1f;
            return(0.0f);
        }