Example #1
0
CShot::CShot(CMap &map,
             const Ogre::Vector2 &vCenter,
             EShotTypes eShotType,
             EShotDirections eShotDirection,
             unsigned int uiDmg)
  :
  CAnimatedSprite(map,
		  CIDGenerator::nextID("Shot_"),
		  map.getShotsEntity(),
		  &map,
                  map.get2dManager(),
                  vCenter - SHOT_SIZE[eShotType] * 0.5,
                  SHOT_SIZE[eShotType]),
  m_eShotDirection(eShotDirection),
        //if (m_uiType == ST_BOLT) new CExplosion(m_Map, getCenter(), CExplosion::ET_BOLT);
        //else if (m_uiType == ST_SKULL) new CExplosion(m_Map, getCenter(), CExplosion::ET_SKULL);
  m_fTimer(0),
  m_eState(SS_NONE),
  m_uiDamages(uiDmg),
  m_pCatchedEnemy(NULL),
  m_sCatchedEnemyID("") {
  setType(eShotType);
  setGravity(SHOT_AFFECTED_BY_GRAVITY[m_uiType] ? c_fGravity : 0);
  constructor_impl();
}
Example #2
0
CShot::CShot(CMap &map,
	     const tinyxml2::XMLElement *pElement)
  : CAnimatedSprite(map,
		    map.getShotsEntity(),
		    &map,
		    map.get2dManager(),
		    pElement,
		    SHOT_SIZE[EnumAttribute<EShotTypes>(pElement, "type", ST_COUNT, true)]),
    m_eShotDirection(EnumAttribute<EShotDirections>(pElement, "direction", SD_RIGHT, true)),
    m_fTimer(RealAttribute(pElement, "timer", 0)),
    m_eState(EnumAttribute<EShotStates>(pElement, "state", SS_NONE)),
    m_uiDamages(IntAttribute(pElement, "damages")),
    m_pCatchedEnemy(NULL),
    m_sCatchedEnemyID(Attribute(pElement, "catched_enemy", Ogre::StringUtil::BLANK)) {
  setGravity(SHOT_AFFECTED_BY_GRAVITY[m_uiType] ? c_fGravity : 0);
  constructor_impl();
}