Пример #1
0
        public override void Execute(AIBrain brain)
        {
            Vector3?hitNormal;
            Vector3?hitPos = brain.ObstacleAhead(lookAhead, out hitNormal);

            if (hitPos.HasValue && hitNormal.HasValue)
            {
                brain.LookAt(hitPos.Value + hitNormal.Value.normalized * normalMultiplier, true);
            }
        }
Пример #2
0
        public override bool Evaluate(AIBrain brain, params ConditionParam[] condParams)
        {
            try {
                if (condParams.Length > 1)
                {
                    lookAhead = condParams[0].AsFloat();
                }
            }
            catch (Exception e) {
                Debug.LogWarningFormat("Improper condParams. {0}", e.Message);
            }

            return(brain.ObstacleAhead(lookAhead * brain.ship.thrustVelocity.magnitude) != null);
        }
Пример #3
0
        public static Vector3?ObstacleAhead(this AIBrain brain, float maxDistance)
        {
            Vector3?normal;

            return(brain.ObstacleAhead(maxDistance, out normal));
        }