Esempio n. 1
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();
}
Esempio n. 2
0
CExplosion::CExplosion(CMap &map, const Ogre::Vector2 &vCenter, EExplosionTypes eExplosionType)
    :
    CAnimatedSprite(map,
                   CIDGenerator::nextID("Explosion_"),
                   map.getExplosionsEntity(),
                   &map,
                   map.get2dManager(),
                   vCenter - EXPLOSION_RELATIVE_OFFSET[eExplosionType],
                   EXPLOSION_SIZES[eExplosionType]),
    m_fFadingTimer(-1) {
    setType(eExplosionType);

    init(1, 1);

    CSpriteTexture::EMirrorTypes eMirrorType = CSpriteTexture::MIRROR_NONE;

    if (m_uiType == ET_BOLT) {
        setupAnimation(0, "bolt_explosion", 5, eMirrorType, &getBoltTexture);
    }
    else if (m_uiType == ET_BOMB) {
        m_vPosition += Ogre::Vector2(0, 0.4);
        setupAnimation(0, "bomb_explosion", 14, eMirrorType, &getBombTexture);
    }
    else if (m_uiType == ET_GREEN_MONSTER) {
        setupAnimation(0, "explosion", 7, eMirrorType, &getEnemyTexturePath<0>);
    }
    else if (m_uiType == ET_KNIGHT) {
        setupAnimation(0, "explosion_right", 5, eMirrorType, &getEnemyTexturePath<1>);
    }
    else if (m_uiType == ET_BEAR) {
        setupAnimation(0, "explosion_right", 1, eMirrorType, &getEnemyTexturePath<2>);
    }
    else if (m_uiType == ET_GHOST) {
        setupAnimation(0, "explosion_right", 4, eMirrorType, &getEnemyTexturePath<3>);
    }
    else if (m_uiType == ET_DARK_MAGICAN) {
        setupAnimation(0, "explosion_right", 4, eMirrorType, &getEnemyTexturePath<4>);
    }
    else if (m_uiType == ET_SANTA) {
        setupAnimation(0, "explosion_right", 9, eMirrorType, &getEnemyTexturePath<5>);
    }
    else if (m_uiType == ET_SKULL) {
        setupAnimation(0, "explosion", 3, eMirrorType, &getSkullTexture);
    }
}