aiClient.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _AICLIENT_H_ 25#define _AICLIENT_H_ 26 27#ifndef _AICONNECTION_H_ 28#include "T3D/aiConnection.h" 29#endif 30#ifndef _TVECTOR_H_ 31#include "core/util/tVector.h" 32#endif 33 34class ShapeBase; 35class Player; 36 37class AIClient : public AIConnection { 38 39 typedef AIConnection Parent; 40 41 private: 42 enum { 43 FireTrigger = 0, 44 JumpTrigger = 2, 45 JetTrigger = 3, 46 GrenadeTrigger = 4, 47 MineTrigger = 5 48 }; 49 50 F32 mMoveSpeed; 51 S32 mMoveMode; 52 F32 mMoveTolerance; // How close to the destination before we stop 53 54 bool mTriggers[MaxTriggerKeys]; 55 56 Player *mPlayer; 57 58 Point3F mMoveDestination; 59 Point3F mLocation; 60 Point3F mLastLocation; // For stuck check 61 62 bool mAimToDestination; 63 Point3F mAimLocation; 64 bool mTargetInLOS; 65 66 SimObjectPtr<ShapeBase> mTargetObject; 67 68 // Utility Methods 69 void throwCallback( const char *name ); 70 public: 71 72 DECLARE_CONOBJECT( AIClient ); 73 74 DECLARE_CALLBACK( void, onConnect, (const char* idString) ); 75 76 enum { 77 ModeStop = 0, 78 ModeMove, 79 ModeStuck, 80 ModeCount // This is in there as a max index value 81 }; 82 83 AIClient(); 84 ~AIClient(); 85 86 U32 getMoveList( Move **movePtr,U32 *numMoves ); 87 88 // ---Targeting and aiming sets/gets 89 void setTargetObject( ShapeBase *targetObject ); 90 S32 getTargetObject() const; 91 92 // ---Movement sets/gets 93 void setMoveSpeed( const F32 speed ); 94 F32 getMoveSpeed() const { return mMoveSpeed; } 95 96 void setMoveMode( S32 mode ); 97 S32 getMoveMode() const { return mMoveMode; } 98 99 void setMoveTolerance( const F32 tolerance ); 100 F32 getMoveTolerance() const { return mMoveTolerance; } 101 102 void setMoveDestination( const Point3F &location ); 103 Point3F getMoveDestination() const { return mMoveDestination; } 104 105 Point3F getLocation() const { return mLocation; } 106 107 // ---Facing(Aiming) sets/gets 108 void setAimLocation( const Point3F &location ); 109 Point3F getAimLocation() const { return mAimLocation; } 110 void clearAim(); 111 112 // ---Other 113 void missionCycleCleanup(); 114 void onAdd( const char *nameSpace ); 115}; 116 117#endif 118