AnimationHandler  ResourceManager::GetAnimation(std::string resID)
{
	unsigned int id = hasher(resID);
	if(pool->AnimationExist(id))
	{
		return AnimationHandler(pool->GetAnimation(id),id,pool);
		
	}
	else return AnimationHandler(false);
}
AnimationHandler ResourceManager::GetAnimationFromMemory(AnimationPtr anim,std::string resID)
{
	unsigned int id = hasher(resID);
	if(pool->AnimationExist(id))
	{
		return AnimationHandler(pool->GetAnimation(id),id,pool);
	}
	else 
	{
		pool->AddAnimation(id,anim);
		return AnimationHandler(anim,id,pool);
	}
}
Example #3
0
EntityPtr EntityFactory::createAnimatedEntity(const string& path, float width, float height) {
	EntitySystemPtr entitySystem = makeShared(mSystemManager->getSystemByType<EntitySystem>(SystemType::ENTITY));
	EntityPtr entity(GCC_NEW Entity());
	entitySystem->addEntity(entity);

	PhysicsSystemPtr physicsSystem = makeShared(mSystemManager->getSystemByType<PhysicsSystem>(SystemType::PHYSICS));
	BodyPtr blockBody(GCC_NEW Body(0.0f, 0.0f, width, height));
	physicsSystem->registerBody(entity->id, blockBody);
	PhysicsComponentPtr physicsComponent(GCC_NEW PhysicsComponent(entity->id, blockBody));

	GraphicsSystemPtr graphicsSystem = makeShared(mSystemManager->getSystemByType<GraphicsSystem>(SystemType::GRAPHICS));
	TexturePtr texture(GCC_NEW Texture(""));
	shared_ptr<TextureDrawable> textureDrawable(GCC_NEW TextureDrawable(texture));
	graphicsSystem->registerDrawable(entity->id, textureDrawable);
	DrawableComponentPtr drawableComponent(GCC_NEW DrawableComponent(entity->id, textureDrawable));

	AnimationSystemPtr animationSystem = makeShared(mSystemManager->getSystemByType<AnimationSystem>(SystemType::ANIMATION));
	AnimationSetPtr animationSet = animationSystem->createAnimationSet(path);
	AnimationHandlerPtr animationHandler(GCC_NEW AnimationHandler(textureDrawable, animationSet, animationSet->fps));
	animationSystem->registerAnimation(entity->id, animationHandler);
	AnimationComponentPtr animationComponent(GCC_NEW AnimationComponent(entity->id, animationHandler));

	InputSystemPtr inputSystem(makeShared(mSystemManager->getSystemByType<InputSystem>(SystemType::INPUT)));
	InputListenerPtr inputListener(GCC_NEW InputListener(entity->id));
	inputSystem->registerEventListener(inputListener);
	InputComponentPtr inputComponent(GCC_NEW InputComponent(entity->id, inputListener));

	entity->addComponent(ComponentPtr(physicsComponent));
	entity->addComponent(ComponentPtr(drawableComponent));
	entity->addComponent(ComponentPtr(animationComponent));
	entity->addComponent(ComponentPtr(inputComponent));

	return entity;
}
AnimationHandler  ResourceManager::GetAnimationFromFile(std::string fileName,std::string resID)
{
	unsigned int id = hasher(resID);
	if(pool->AnimationExist(id))
	{
		return AnimationHandler(pool->GetAnimation(id),id,pool);
	}
	else
	{
		AnimationPtr anim = AssetLoader::GetPtr()->LoadAnimation(fileName);
		if(anim.IsNull())
			return AnimationHandler(false);

		AnimationHandler handler = GetAnimationFromMemory(anim,resID);

		return handler;
	}
}
void AMMO_Character::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (bIsDead)
	{
		OverheadUI->HPBarValue = 0;
		Player_SkeletalMeshComponent->SetWorldRotation(DeathRotation);
		return;
	}

	LockedTargetMechanics();

	ArcherFocusMode(DeltaTime);

	HealingPotionMechanic(DeltaTime);

	GetOtherCharacterInfo();
	UI_Updater();

	RotationFixer();
	AnimationHandler();
	MeleeAttackRaycasts();
}