--****************************************************************************** -- 020 移動要塞(移動ダミー) *hard --****************************************************************************** dofile("game:\\common\\airesource\\script\\include\\include.lua"); dofile("game:\\common\\event\\include\\m020\\pointid.lua"); dofile("game:\\common\\event\\include\\m020\\entityid.lua"); dofile("game:\\common\\event\\include\\m020\\constvalue.lua"); ----------------------------------------------------------------------------------- -- 定数 ----------------------------------------------------------------------------------- -- 捕捉パラメータ CONST__TARGETTING_PARAM = { -- レーダー LADER = { DISTANCE = 1200; -- レーダーの距離 ANGLE = 180; -- レーダーの角度(真正面を0度とした円錐の側面までの角度(度)) }; }; -- 移動用パラメータ CONST__MOVE_PARAM = { DIST = 700; -- この距離まで近づく MARGIN = 50; -- 目的距離からこれだけのブレ幅は許す }; ACROSS_COMP = "across_comp"; ----------------------------------------------------------------------------------- -- 初期化 ----------------------------------------------------------------------------------- RegistInitializeFuncitonName( "InitialSetup" ); function InitialSetup( context ) LogAI( "■移動要塞:初期化" ); AddGlobalValue( context , ACROSS_COMP , 0 ); -- オペレーションレイヤー設定 AddInitialLayer( context , "InitMove" , "Move" , 0.3 ); -- オペレーションレイヤー(移動) -- 基本設定 DefaultSetup( context , false ); -- デフォルト設定 -- SetEnableTurnToTarget( context, false); -- ジャンプしない -- SetTimeLengthJump( context, 0, 1); -- ▼進入禁止 SetKeepOutRegion( context , m020_PT_PROHIBITION_01 ); SetKeepOutRegion( context , m020_PT_PROHIBITION_02 ); -- /////ターゲット補足関数 Targetting_CatchUpWithConeInSide( context , CONST__TARGETTING_PARAM.LADER.DISTANCE , CONST__TARGETTING_PARAM.LADER.ANGLE ); -- レーダー(角度倍 end ----------------------------------------------------------------------------------- -- オペレーションレイヤー(移動) ----------------------------------------------------------------------------------- function InitMove() end function Move( context ) local across = GetGlobalValue( context , ACROSS_COMP ) if ( IsIntersectRegion( context , m020_PT_APPROACH_03 ) ) then ModifyGlobalValue( context , ACROSS_COMP , 1 ); end if ( across == 1 ) then SetEnableTurnToTarget( context , true ); Op_Nothing( context , OperationIdentifier( 1 ) , 10 , 10 , 1 , nil ); else SetEnableTurnToTarget( context , false ); Op_GoForward( context , OperationIdentifier( 2 ) , 10 , 10 , 1 , nil ); end end --[[ Op_LoopQueue( context , OperationIdentifier( 1 ) , 300 , 300 , 1 , nil , "ApproachLoopQueue_Construct" , "ApproachLoopQueue_Update" , nil , nil , "接近敵:ループキュー" ); end ]] function ApproachLoopQueue_Construct( context ) -- Queue_GoForward( context, 300, 300, nil, nil, "EvalRouteApproach" ); Queue_FollowRoute( context, 300, 300, nil, nil, "EvalRouteApproach", m020_PT_APPROACH_01 , m020_PT_APPROACH_03, true); Queue_Layer( context, 20, 20, nil, nil, nil, "MoveLayer", "EvalLayer" , "キュー:移動"); end function ApproachLoopQueue_Update( context ) end function EvalRouteApproach( context ) if( GetToPointDistance( context, m020_PT_APPROACH_03) < 50) then context:Complete(); end end function MoveLayer( context ) SetEnableTurnToTarget( context , true ); local dist = GetToTargetDistance( context ); Op_Nothing( context , OperationIdentifier( 11 ) , 1.0 , 2.0 , 1 , nil ); --[[ if ( IsExistTarget( context ) ) then if ( dist > CONST__MOVE_PARAM.DIST ) then Op_KeepDist( context , OperationIdentifier( 2 ) , 1.0 , 2.0 , 1 , nil , CONST__MOVE_PARAM.DIST , CONST__MOVE_PARAM.MARGIN ); else Op_Nothing( context , OperationIdentifier( 3 ) , 1.0 , 2.0 , 1 , nil ); Op_RoundRear( context , OperationIdentifier( 4 ) , 1.0 , 2.0 , 1 , nil ); end else Op_RandomWalk( context , OperationIdentifier( 5 ) , 2.0 , 3.0 , 1 , nil ); end ]] end function EvalLayer( context ) -- Completeしない end