Ejemplo n.º 1
0
		MyProcessingUnitA()
			: Dia::Application::ProcessingUnit(kUniqueId)
			, myPhaseA(this)
			, myPhaseB(this)
			, myPhaseC(this)
			, myModuleA(this)
			, myModuleB(this)
			, myModuleC(this)
			, myModuleD(this)
		{
			// Add Phases/Modules
			AddPhase(&myPhaseA);
			AddPhase(&myPhaseB);
			AddPhase(&myPhaseC);

			AddModule(&myModuleA);
			AddModule(&myModuleB);
			AddModule(&myModuleC);
			AddModule(&myModuleD);

			// Setup Phase Transitions
			SetInitialPhase(&myPhaseA);
			AddPhaseTransiton(&myPhaseA, &myPhaseB);

			// We call this from here to build all dependancies. We dont need to do this here, intead 
			// we could of done it in the code below if there was dynamic adding of modules or phases
			// but for this cas case this is a nicer cleaner solution.
			Initialize();
		}
ApplicationProcessingUnit::ApplicationProcessingUnit()
	: Dia::Application::ProcessingUnit(kUniqueId)
	, mBootPhase(this)
	, mBootStrapPhase(this)
	, mCorePhase(this)
	, mApplicationTime(this)
	, mQuitApplication(false)
{

	// Add Phases/Modules
	AddPhase(&mBootPhase);
	AddPhase(&mCorePhase);

	mBootPhase.AddModule(&mApplicationTime);
	mCorePhase.AddModule(&mApplicationTime);

	AddModule(&mApplicationTime);

	// Setup Phase Transitions
	SetInitialPhase(&mBootPhase);
	AddPhaseTransiton(&mBootPhase, &mCorePhase);
	AddPhaseTransiton(&mCorePhase, &mBootStrapPhase);

	// We call this from here to build all dependancies. We dont need to do this here, intead 
	// we could of done it in the code below if there was dynamic adding of modules or phases
	// but for this cas case this is a nicer cleaner solution.
	Initialize();
}
Ejemplo n.º 3
0
void PhasingHandler::AddPhase(WorldObject* object, uint32 phaseId, bool updateVisibility)
{
    bool changed = object->GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), nullptr);

    if (Unit* unit = object->ToUnit())
    {
        unit->OnPhaseChange();
        ForAllControlled(unit, [&](Unit* controlled)
        {
            AddPhase(controlled, phaseId, updateVisibility);
        });
        unit->RemoveNotOwnSingleTargetAuras(true);
    }

    UpdateVisibilityIfNeeded(object, updateVisibility, changed);
}