1 #using scripts\shared\ai\systems\animation_selector_table;
2 #using scripts\shared\array_shared;
4 #insert scripts\shared\ai\systems\blackboard.gsh;
5 #insert scripts\shared\ai\systems\animation_selector_table.gsh;
6 #insert scripts\shared\shared.gsh;
24 if ( IsArray( animations ) && animations.size > 0 )
32 PixBeginEvent(
"Evaluator_CheckAnimationAgainstGeo" );
34 assert( IsActor( entity ) );
39 localDeltaHalfVector = GetMoveDelta( animation, 0, 0.5, entity );
40 midPoint = entity LocalToWorldCoords( localDeltaHalfVector );
42 midPoint = ( midPoint[0], midPoint[1], entity.origin[2] );
45 RecordLine( entity.origin, midPoint,
ORANGE,
"Animscript", entity );
48 if( entity MayMoveToPoint( midPoint,
true,
true ) )
50 localDeltaVector = GetMoveDelta( animation, 0, 1, entity );
51 endPoint = entity LocalToWorldCoords( localDeltaVector );
52 endPoint = ( endPoint[0], endPoint[1], entity.origin[2] );
55 RecordLine( midPoint, endPoint,
ORANGE,
"Animscript", entity );
58 if ( entity MayMoveFromPointToPoint( midPoint, endPoint,
true,
true ) )
71 PixBeginEvent(
"Evaluator_CheckAnimationEndPointAgainstGeo" );
73 assert( IsActor( entity ) );
75 localDeltaVector = GetMoveDelta( animation, 0, 1, entity );
76 endPoint = entity LocalToWorldCoords( localDeltaVector );
77 endPoint = ( endPoint[0], endPoint[1], entity.origin[2] );
79 if( entity MayMoveToPoint( endPoint,
false,
false ) )
91 PixBeginEvent(
"Evaluator_CheckAnimationForOverShootingGoal" );
93 assert( IsActor( entity ) );
95 localDeltaVector = GetMoveDelta( animation, 0, 1, entity );
96 endPoint = entity LocalToWorldCoords( localDeltaVector );
97 animDistSq = LengthSquared( localDeltaVector );
99 if( entity HasPath() )
101 startPos = entity.origin;
102 goalPos = entity.pathGoalPos;
104 assert( IsDefined( goalPos ) );
105 distToGoalSq = DistanceSquared( startPos, goalPos );
108 if( animDistSq < distToGoalSq )
121 assert( IsActor( entity ) );
123 localDeltaVector = GetMoveDelta( animation, 0, 1, entity );
124 endPoint = entity LocalToWorldCoords( localDeltaVector );
127 if( IsPointOnNavMesh( endPoint, entity ) )
135 localDeltaVector = GetMoveDelta( animation, 0, 1, entity );
136 endPoint = entity LocalToWorldCoords( localDeltaVector );
137 animDistSq = LengthSquared( localDeltaVector );
139 startPos = entity.origin;
140 goalPos = entity.pathGoalPos;
142 distToGoalSq = DistanceSquared( startPos, goalPos );
144 return distToGoalSq < animDistSq && entity IsPosAtGoal( endPoint );
149 assert( IsArray( animations ),
"An array of animations must be passed in to validate against." );
150 assert( IsArray( tests ),
"An array of test functions must be passed in to validate an animation." );
153 foreach ( aliasAnimations
in animations )
155 if ( aliasAnimations.size > 0 )
158 animation = aliasAnimations[0];
160 foreach ( test
in tests )
162 if ( ![[test]]( entity, animation ) )
180 if( animations.size > 0 )
204 Record3DText(
"" + GetTime() +
": Turn Evaluator", entity.origin,
ORANGE,
"Animscript", entity );
207 if( animations.size > 0 )
224 if( !IsDefined( entity.pathGoalPos ) )
227 if( animations.size > 0 )