ODEProjectile.h

Go to the documentation of this file.
00001 #ifndef _ODE_PROJECTILE_H
00002 #define _ODE_PROJECTILE_H
00003 
00004 #include "MercuryODE.h" 
00005 #include "MercuryShapes.h" 
00006 
00007 class Projectile : public MercuryODEObjectLoadable
00008 {
00009 public:
00010     Projectile() { }
00011     Projectile( const MString & sName ) { SetName( sName ); }
00012     ~Projectile();
00013     virtual void Init();
00014     virtual bool Collide( MercuryODEObject * pHit, dContact & pContact, MercuryODEWorld * pWorld );
00015     virtual void Message( int Message, PStack & data, const MString & name );
00016     virtual void Update( const float dTime );
00017     
00018     void NotifyClass( MercuryObject * pToNotify, const MString & sMessage ) { m_pToNotify = pToNotify; m_sMessage=sMessage; }
00019     void EnableForShot( dSpaceID sID, float fLength, const MercuryPoint & pCenter, const MercuryPoint & pDirection );
00020     void Disable();
00021     CLASS_RTTI( Projectile, MercuryODEObjectLoadable );
00022 private:
00023     dGeomID     m_pRay; //For use only with finding targets
00024     MercuryObject * m_pToNotify;
00025     MString         m_sMessage;
00026     MercuryShape    m_shpTracer;
00027 };
00028 
00029 class VirtualProjectile : public MercuryODEObject
00030 {
00031 public:
00032     VirtualProjectile()
00033         :MercuryODEObject(), m_pRay(0), m_pToNotify(NULL)
00034     {}
00035 
00036     virtual void Init();
00037     virtual bool Collide( MercuryODEObject* pHit, dContact& pContact, MercuryODEWorld* pWorld );
00038     inline void NotifyClass( MercuryObject* pToNotify, const MString & sMessage ) { m_pToNotify = pToNotify; m_sMessage=sMessage; }
00039     void EnableForShot( dSpaceID sID, float fLength, const MercuryPoint & pCenter, const MercuryPoint & pDirection );
00040     void Disable();
00041     CLASS_RTTI( VirtualProjectile, MercuryODEObject );
00042 protected:
00043     dGeomID m_pRay; //For use only with finding targets
00044     MercuryObject* m_pToNotify;
00045     MString m_sMessage;
00046 };
00047 
00048 #endif
00049 
00050 /* 
00051  * Copyright (c) 2006, Charles Lohr
00052  * All rights reserved.
00053  *
00054  * Redistribution and use in source and binary forms, with or
00055  * without modification, are permitted provided that the following
00056  * conditions are met:
00057  *  -   Redistributions of source code must retain the above
00058  *      copyright notice, this list of conditions and the following disclaimer.
00059  *  -   Redistributions in binary form must reproduce the above copyright
00060  *      notice, this list of conditions and the following disclaimer in
00061  *      the documentation and/or other materials provided with the distribution.
00062  *  -   Neither the name of the Mercury Engine nor the names of its
00063  *      contributors may be used to endorse or promote products derived from
00064  *      this software without specific prior written permission.
00065  *
00066  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00067  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00068  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00069  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00070  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00071  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00072  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00073  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00074  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00075  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00076  */

Hosted by SourceForge.net Logo