//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // //=============================================================================// #include "cbase.h" #include "beam_shared.h" #include "ai_motor.h" #include "asw_ai_behavior_backoff.h" #include "ai_hint.h" #include "ai_navigator.h" #include "ai_memory.h" #include "asw_alien.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" BEGIN_DATADESC( CAI_ASW_BackoffBehavior ) END_DATADESC(); LINK_BEHAVIOR_TO_CLASSNAME( CAI_ASW_BackoffBehavior ); //------------------------------------------------------------------------------ // Purpose: constructor //------------------------------------------------------------------------------ CAI_ASW_BackoffBehavior::CAI_ASW_BackoffBehavior( ) { } //------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_BackoffBehavior::KeyValue( const char *szKeyName, const char *szValue ) { return BaseClass::KeyValue( szKeyName, szValue ); } //------------------------------------------------------------------------------ // Purpose: precaches any additional assets this behavior needs //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::Precache( void ) { BaseClass::Precache(); } //------------------------------------------------------------------------------ // Purpose: //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::Init( ) { #if 0 CASW_Alien *pNPC = static_cast< CASW_Alien * >( GetOuter() ); if ( !pNPC ) { return; } #endif } //------------------------------------------------------------------------------ // Purpose: determines if we can use this behavior currently // Output : returns true if this behavior is able to run //------------------------------------------------------------------------------ bool CAI_ASW_BackoffBehavior::CanSelectSchedule() { if ( !GetOuter()->IsInterruptable() ) { return false; } return BaseClass::CanSelectSchedule(); } //------------------------------------------------------------------------------ // Purpose: sets / clears conditions for when the behavior is active. this is // generally a larger set of conditions to interrupt any tasks. //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::GatherConditions() { BaseClass::GatherConditions(); } //------------------------------------------------------------------------------ // Purpose: sets / clears conditions for when the behavior is not active. this is // mainly to have a smaller set of conditions to wake up the behavior. //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::GatherConditionsNotActive() { BaseClass::GatherConditionsNotActive(); } //------------------------------------------------------------------------------ // Purpose: general purpose routine to collect conditions used both during active // and non-active states of the behavior. //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::GatherCommonConditions() { BaseClass::GatherCommonConditions(); } void CAI_ASW_BackoffBehavior::BeginScheduleSelection() { BaseClass::BeginScheduleSelection(); } //------------------------------------------------------------------------------ // Purpose: routine called to start when a task initially starts // Input : pTask - the task structure //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::StartTask( const Task_t *pTask ) { switch( pTask->iTask ) { case TASK_CLEAR_BACK_OFF_STATUS: { SetBehaviorParam( m_StatusParm, -1 ); TaskComplete(); break; } default: BaseClass::StartTask( pTask ); break; } } //------------------------------------------------------------------------------ // Purpose: routine called every frame when a task is running // Input : pTask - the task structure //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::RunTask( const Task_t *pTask ) { #if 0 switch( pTask->iTask ) { default: BaseClass::RunTask( pTask ); break; } #endif BaseClass::RunTask( pTask ); } //------------------------------------------------------------------------------ // Purpose: routine called to select what schedule we want to run // Output : returns the schedule id of the schedule we want to run //------------------------------------------------------------------------------ int CAI_ASW_BackoffBehavior::SelectSchedule() { return SCHED_BACKOFF_MOVE_AWAY; } //------------------------------------------------------------------------------ // Purpose: // Input : // Output : //------------------------------------------------------------------------------ void CAI_ASW_BackoffBehavior::HandleBehaviorEvent( CBaseEntity *pInflictor, BehaviorEvent_t eEvent, int nParm ) { #if 0 switch( eEvent ) { } #endif } AI_BEGIN_CUSTOM_SCHEDULE_PROVIDER( CAI_ASW_BackoffBehavior ) DECLARE_TASK( TASK_CLEAR_BACK_OFF_STATUS ) DEFINE_SCHEDULE ( SCHED_BACKOFF_MOVE_AWAY, " Tasks" " TASK_STOP_MOVING 0" " TASK_PLAY_SEQUENCE ACTIVITY:ACT_STEP_BACK" " TASK_CLEAR_BACK_OFF_STATUS 0" "" " Interrupts" ); AI_END_CUSTOM_SCHEDULE_PROVIDER() #include "tier0/memdbgoff.h"