//----------------------------------------"--------------------------------
void CCharge::Update(float frameTime, uint32 frameId)
{
	if (m_charging)
	{
		if (m_chargeTimer > 0.0f)
		{
			m_chargeTimer -= frameTime;

			if (m_chargeTimer <= 0.0f)
			{
				m_charged++;

				if (m_charged >= m_pShared->chargeparams.max_charges)
				{
					m_charging = false;
					m_charged = m_pShared->chargeparams.max_charges;

					if (!m_pShared->chargeparams.shoot_on_stop)
					{
						if (m_firing)
						{
							ChargedShoot();
						}
					}
				}
			}
		}

		m_pWeapon->RequireUpdate(eIUS_FireMode);
	}
	else
	{
		if (!m_pShared->chargeparams.shoot_on_stop)
		{
			CAutomatic::Update(frameTime, frameId);
		}
		else
		{
			CSingle::Update(frameTime, frameId);
		}
	}

	// update spinup effect
	if (m_chTimer > 0.0f)
	{
		m_chTimer -= frameTime;

		if (m_chTimer <= 0.0f)
		{
			m_chTimer = 0.0f;

			if (m_chId)
			{
				ChargeEffect(false);
			}
		}

		m_pWeapon->RequireUpdate(eIUS_FireMode);
	}
}
//------------------------------------------------------------------------
void CCharge::StopFire()
{
	if (m_fireParams->chargeparams.shoot_on_stop)
	{
		if (m_charged > 0)
		{
			ChargedShoot();
		}
		m_pWeapon->PlayAction(GetFragmentIds().uncharge);
		m_charged = 0;
		m_charging = false;
		m_chargeTimer = 0.0f;
	}

	CAutomatic::StopFire();
}
Beispiel #3
0
//------------------------------------------------------------------------
void CCharge::StopFire()
{
	if (m_chargeparams.shoot_on_stop)
	{
		if (m_charged > 0)
		{
			ChargedShoot();
		}
		m_pWeapon->PlayAction(m_chargeactions.uncharge.c_str());
		m_charged = 0;
		m_charging = false;
		m_chargeTimer = 0.0f;
	}

	CAutomatic::StopFire();
}
Beispiel #4
0
//------------------------------------------------------------------------
bool CCharge::Shoot(bool resetAnimation, bool autoreload /* =true */, bool noSound /* =false */)
{
    m_autoreload = autoreload;

    if(!m_charged)
    {
        m_charging = true;
        m_chargeTimer = m_pShared->chargeparams.time;
        m_pWeapon->PlayAction(m_pShared->chargeactions.charge.c_str(),  0, false, CItem::eIPAF_Default|CItem::eIPAF_RepeatLastFrame);

        ChargeEffect(true);
    }
    else if(!m_charging && m_firing)
        ChargedShoot();

    m_pWeapon->RequireUpdate(eIUS_FireMode);

    return true;
}
//------------------------------------------------------------------------
bool CCharge::Shoot(bool resetAnimation, bool autoreload /* =true */, bool isRemote)
{
	m_autoreload = autoreload;

	if (!m_charged)
	{
		m_charging = true;
		m_chargeTimer = m_fireParams->chargeparams.time;
		m_pWeapon->PlayAction(GetFragmentIds().charge,  0, false, CItem::eIPAF_Default);

		ChargeEffect(true);
	}
	else if (!m_charging && m_firing)
		ChargedShoot();

	m_pWeapon->RequireUpdate(eIUS_FireMode);

	return true;
}