예제 #1
0
bool SpellTimer::Finish(Unit *target)
{
    // timer can be also used without spell cast in the end, for such case set spellId to NULL
    // handle cast part only for timers with spellId
    if (spellId_m)
    {
        // if timer for not existing spell, dont even try to finish it
        SpellEntry const *spellInfo = GetTimerSpellEntry();
        if (!spellInfo)
            return false;

        Unit* uCaster = getCaster();
        Unit* uTarget = findTarget(target);

        // checking just target, caster checked in getTarget()
        if (!uTarget || !uTarget->IsInWorld())
            return false;

        if (castType_m == CAST_TYPE_FORCE)
            uCaster->InterruptNonMeleeSpells(false);

        uCaster->CastSpell(uTarget, spellInfo, false);
    }
    Cooldown();
    SetValue(TIMER_VALUE_JUST_FINISHED, true);
    return true;
}
예제 #2
0
void ACross::AOEDisengage()
{
	AOECollisionComp->SetSphereRadius(0.f, false);
	bIsFiring = false;
	GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Green, "UnCross");
	bCanFire = false;
	Cooldown();
}
예제 #3
0
    void Animation::Update() {
        // Increment the current frame within the animation that we are on
		// Update if there are any images
		if (Images.size() > 0)
		if (isCooldown)
			Cooldown();
		else
		if (isPlaying)
		{
		if (!isReverse)
		{
			double FrameIncrease = (Clock.GetElapsedTime() * FramesPerSecond);
			Clock.Reset();
			CurrentFrame += FrameIncrease;

			// And the frame of the current image that we are on
			CurrentImageFrame += FrameIncrease;
			// If we have been on the frame as long as we should of
			if (CurrentImageFrame > ImageLengths.at(CurrentImage)) 
			{
				// Go to the next image
				CurrentImage++;
				// We are now on frame 0 of this image
				CurrentImageFrame = 0;
				// If this is more frames then we have
				if (CurrentImage >= Images.size()) 
				{
					// Restart the animation
					Reset();
					if(CooldownTime > 0)
					{
						// Setting up remaining cooldown time
						CurrentFrame = CooldownTime * FramesPerSecond;
						isCooldown = true;
					}
				}
				// Change the image
				SetImage(*Images.at(CurrentImage));
			}
		}
		else UpdateReverse();
		}
    }