unitWeapons.h

Go to the documentation of this file.
00001 /*
00002  * unitWeapons.h
00003  *
00004  *  Created on: Feb 28, 2012
00005  *      Author: sushil
00006  */
00007 
00008 #ifndef UNITWEAPONS_H_
00009 #define UNITWEAPONS_H_
00010 
00011 #include <aspect.h>
00012 #include <enums.h>
00013 
00014 #include <target.h>
00015 
00016 #include <weaponMgr.h>
00017 #include <vector>
00018 
00019 namespace FastEcslent {
00020 
00021         class DistanceMgr;
00022         class Entity;
00023 
00024         class Weapon: public UnitAspect {
00025         private:
00026                 Target target;
00027 
00028                 std::vector<Entity*> getUnitsInRadius(Entity* ent, double radius, bool enemy);
00029                 std::vector<FastEcslent::Entity*> getUnitsInRectangle(Entity* src, Entity* tgt, double length, double width, bool enemy);
00030                 bool isPointInRectangle(Ogre::Vector3 sp1, Ogre::Vector3 sp2, Ogre::Vector3 sp3, Ogre::Vector3 sp4, Ogre::Vector3 point);
00031                 double getAreaTriangle(Ogre::Vector3 tp1, Ogre::Vector3 tp2, Ogre::Vector3 tp3);
00032                 int              STANDSTILL;
00033                 int              BEINGATTACKED;
00034                 double      m_cooldown;
00035                 double      m_beingAttacked;
00036 
00037                 double      m_onfire;
00038         public:
00039                 const WeaponType* weaponType;
00040 
00041                 //double*      damageDone;
00042                 double      damageMultiplier;
00043 
00044 
00045                 //double      hitpoints;
00046                 //double*      maxHitpoints;
00047                 double      armor;
00048 
00049                 DistanceMgr* distanceMgr;
00050                 WeaponMgr*   weaponMgr;
00051 
00052                 Weapon(Entity *ent, UnitAspectType ast, const WeaponType *wType);
00053                 Weapon(Entity *ent, UnitAspectType ast);
00054                 void dealDamageToTarget(Target tgt, double dt); //sets target
00055 
00059                 void dealEnemySplashDamageToTarget(Target tgt, double dt, double radius);
00063                 void dealLineSplashDamageToTarget(Target tgt, double dt, double length, double width);
00064 
00065 
00066                 void  setTarget();
00067                 Target getTarget();
00068                 void takeDamage(double amt);
00069                 void takeDamage(double amt, double dt);
00070                 virtual void  tick(double dt);
00071                 virtual void  init();
00072 
00073                 double isBeingAttacked(){return m_beingAttacked>0?true:false;};
00074                 void resetBeingAttack(){m_beingAttacked = 0;};
00075 
00076 
00077         };
00078 
00079 
00080 
00081 }
00082 
00083 
00084 #endif /* UNITWEAPONS_H_ */

Generated on Fri Dec 13 14:54:16 2013 for FastECSLent by  doxygen 1.5.4