Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. //=========================================================
  9. // NPC template
  10. //=========================================================
  11. #include "cbase.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. #if 0
  15. //=========================================================
  16. // NPC's Anim Events Go Here
  17. //=========================================================
  18. class CMyNPC : public CAI_BaseNPC
  19. {
  20. public:
  21. DECLARE_CLASS( CMyNPC, CAI_BaseNPC );
  22. void Spawn( void );
  23. void Precache( void );
  24. void MaxYawSpeed( void );
  25. int Classify ( void );
  26. void HandleAnimEvent( animevent_t *pEvent );
  27. };
  28. LINK_ENTITY_TO_CLASS( my_NPC, CMyNPC );
  29. //=========================================================
  30. // Classify - indicates this NPC's place in the
  31. // relationship table.
  32. //=========================================================
  33. int CMyNPC::Classify ( void )
  34. {
  35. return CLASS_MY_NPC;
  36. }
  37. //=========================================================
  38. // SetYawSpeed - allows each sequence to have a different
  39. // turn rate associated with it.
  40. //=========================================================
  41. float CMyNPC::MaxYawSpeed ( void )
  42. {
  43. switch ( m_Activity )
  44. {
  45. case ACT_IDLE:
  46. default:
  47. return 90;
  48. }
  49. }
  50. //=========================================================
  51. // HandleAnimEvent - catches the NPC-specific messages
  52. // that occur when tagged animation frames are played.
  53. //=========================================================
  54. void CMyNPC::HandleAnimEvent( animevent_t *pEvent )
  55. {
  56. switch( pEvent->event )
  57. {
  58. case 0:
  59. default:
  60. CAI_BaseNPC::HandleAnimEvent( pEvent );
  61. break;
  62. }
  63. }
  64. //=========================================================
  65. // Spawn
  66. //=========================================================
  67. void CMyNPC::Spawn()
  68. {
  69. Precache( );
  70. engine.SetModel(edict(), "models/mymodel.mdl");
  71. UTIL_SetSize( this, Vector( -12, -12, 0 ), Vector( 12, 12, 24 ) );
  72. SetSolid( SOLID_SLIDEBOX );
  73. SetMoveType( MOVETYPE_STEP );
  74. m_bloodColor = BLOOD_COLOR_GREEN;
  75. m_iHealth = 8;
  76. m_vecViewOffset = Vector ( 0, 0, 0 );// position of the eyes relative to NPC's origin.
  77. m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result )
  78. m_NPCState = NPCSTATE_NONE;
  79. NPCInit();
  80. }
  81. //=========================================================
  82. // Precache - precaches all resources this NPC needs
  83. //=========================================================
  84. void CMyNPC::Precache()
  85. {
  86. engine.PrecacheModel("models/mymodel.mdl");
  87. }
  88. //=========================================================
  89. // AI Schedules Specific to this NPC
  90. //=========================================================
  91. #endif