Vehicle component has "CurrentRPM"
This commit is contained in:
@@ -12,7 +12,7 @@ struct Vehicle : Component
|
|||||||
Vehicle()
|
Vehicle()
|
||||||
: MaxTorque(1000.0f), MinRPM(200.0f), OptimalRPM(3000.0f), MaxRPM(6000.0f), MaxSteeringAngle(35), TopSpeed(90.0f),
|
: MaxTorque(1000.0f), MinRPM(200.0f), OptimalRPM(3000.0f), MaxRPM(6000.0f), MaxSteeringAngle(35), TopSpeed(90.0f),
|
||||||
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(5500.0f), DownshiftRPM(1000.0f),
|
MaxSpeedFullSteeringAngle(40.0f), SpringDamping(1.f), UpshiftRPM(5500.0f), DownshiftRPM(1000.0f),
|
||||||
gearsRatio0(3.0f), gearsRatio1(2.25f), gearsRatio2(1.5f), gearsRatio3(1.0f){ }
|
gearsRatio0(3.0f), gearsRatio1(2.25f), gearsRatio2(1.5f), gearsRatio3(1.0f), currentRPM(0.0f){ }
|
||||||
float MaxTorque;
|
float MaxTorque;
|
||||||
float MinRPM;
|
float MinRPM;
|
||||||
float OptimalRPM;
|
float OptimalRPM;
|
||||||
@@ -29,6 +29,7 @@ struct Vehicle : Component
|
|||||||
float gearsRatio1;
|
float gearsRatio1;
|
||||||
float gearsRatio2;
|
float gearsRatio2;
|
||||||
float gearsRatio3;
|
float gearsRatio3;
|
||||||
|
float currentRPM;
|
||||||
|
|
||||||
Vehicle* Clone() const override { return new Vehicle(*this); }
|
Vehicle* Clone() const override { return new Vehicle(*this); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ void Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
|||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
auto vehicleComponent = m_World->GetComponent<Components::Vehicle>(car);
|
||||||
|
vehicleComponent->currentRPM = m_Vehicles[car]->calcRPM();
|
||||||
|
|
||||||
|
|
||||||
m_Vehicles[car]->getChassis()->activate();
|
m_Vehicles[car]->getChassis()->activate();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void Systems::SoundSystem::Update(double dt)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FMOD_Sound_Release(m_DeleteSounds[it->first]);
|
// FMOD_Sound_Release(m_DeleteSounds[it->first]);
|
||||||
// m_DeleteSounds.erase(it->first);
|
m_DeleteSounds.erase(it->first);
|
||||||
it = m_DeleteChannels.erase(it);
|
it = m_DeleteChannels.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID par
|
|||||||
if(emitter)
|
if(emitter)
|
||||||
{
|
{
|
||||||
FMOD_CHANNEL* channel = m_Channels[entity];
|
FMOD_CHANNEL* channel = m_Channels[entity];
|
||||||
//FMOD_SOUND* sound = m_Sounds[entity];
|
FMOD_SOUND* sound = m_Sounds[entity];
|
||||||
auto eTransform = m_World->GetComponent<Components::Transform>(entity);
|
auto eTransform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
|
||||||
glm::vec3 tPos = m_TransformSystem->AbsolutePosition(entity);
|
glm::vec3 tPos = m_TransformSystem->AbsolutePosition(entity);
|
||||||
@@ -137,9 +137,9 @@ bool Systems::SoundSystem::OnComponentCreated(const Events::ComponentCreated &ev
|
|||||||
float maxDist = emitter->MaxDistance;
|
float maxDist = emitter->MaxDistance;
|
||||||
float minDist = emitter->MinDistance;
|
float minDist = emitter->MinDistance;
|
||||||
float pitch = emitter->Pitch;
|
float pitch = emitter->Pitch;
|
||||||
//LoadSound(sound, path, maxDist, minDist);
|
LoadSound(sound, path, maxDist, minDist);
|
||||||
m_Channels.insert(std::make_pair(emitter->Entity, channel));
|
m_Channels.insert(std::make_pair(emitter->Entity, channel));
|
||||||
// m_Sounds.insert(std::make_pair(emitter->Entity, sound));
|
m_Sounds.insert(std::make_pair(emitter->Entity, sound));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ bool Systems::SoundSystem::PlaySFX(const Events::PlaySFX &event)
|
|||||||
|
|
||||||
eComponent->type = Components::SoundEmitter::SoundType::SOUND_3D;
|
eComponent->type = Components::SoundEmitter::SoundType::SOUND_3D;
|
||||||
Sound* sound = ResourceManager->Load<Sound>("Sound3D", event.Resource);
|
Sound* sound = ResourceManager->Load<Sound>("Sound3D", event.Resource);
|
||||||
//m_Sounds[eEntity] = *sound;
|
m_Sounds[eEntity] = *sound;
|
||||||
FMOD_Sound_Set3DMinMaxDistance(*sound, eComponent->MinDistance, eComponent->MaxDistance);
|
FMOD_Sound_Set3DMinMaxDistance(*sound, eComponent->MinDistance, eComponent->MaxDistance);
|
||||||
|
|
||||||
PlaySound(&m_Channels[eEntity], *sound, 1.0, eComponent->Loop);
|
PlaySound(&m_Channels[eEntity], *sound, 1.0, eComponent->Loop);
|
||||||
@@ -181,6 +181,8 @@ bool Systems::SoundSystem::PlayBGM(const Events::PlayBGM &event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Systems::SoundSystem::StopSound(const Events::StopSound &event)
|
bool Systems::SoundSystem::StopSound(const Events::StopSound &event)
|
||||||
{
|
{
|
||||||
auto eComp = m_World->GetComponent<Components::SoundEmitter>(event.Emitter);
|
auto eComp = m_World->GetComponent<Components::SoundEmitter>(event.Emitter);
|
||||||
@@ -222,8 +224,8 @@ void Systems::SoundSystem::OnComponentRemoved(EntityID entity, std::string type,
|
|||||||
if(emitter)
|
if(emitter)
|
||||||
{
|
{
|
||||||
m_DeleteChannels.insert(std::make_pair(entity, m_Channels[entity]));
|
m_DeleteChannels.insert(std::make_pair(entity, m_Channels[entity]));
|
||||||
//m_DeleteSounds.insert(std::make_pair(entity, m_Sounds[entity]));
|
m_DeleteSounds.insert(std::make_pair(entity, m_Sounds[entity]));
|
||||||
m_Channels.erase(entity);
|
m_Channels.erase(entity);
|
||||||
//m_Sounds.erase(entity);
|
m_Sounds.erase(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,7 @@ private:
|
|||||||
std::map<EntityID, FMOD_CHANNEL*> m_Channels;
|
std::map<EntityID, FMOD_CHANNEL*> m_Channels;
|
||||||
std::map<EntityID, FMOD_CHANNEL*> m_DeleteChannels;
|
std::map<EntityID, FMOD_CHANNEL*> m_DeleteChannels;
|
||||||
std::map<EntityID, FMOD_SOUND*> m_DeleteSounds;
|
std::map<EntityID, FMOD_SOUND*> m_DeleteSounds;
|
||||||
|
std::map<EntityID, FMOD_SOUND*> m_Sounds;
|
||||||
std::shared_ptr<Systems::TransformSystem> m_TransformSystem;
|
std::shared_ptr<Systems::TransformSystem> m_TransformSystem;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -445,9 +445,12 @@ EntityID Systems::TankSteeringSystem::CreateTank(int playerID)
|
|||||||
player->ID = playerID;
|
player->ID = playerID;
|
||||||
auto tankSteering = m_World->AddComponent<Components::TankSteering>(tank);
|
auto tankSteering = m_World->AddComponent<Components::TankSteering>(tank);
|
||||||
m_World->AddComponent<Components::Input>(tank);
|
m_World->AddComponent<Components::Input>(tank);
|
||||||
|
m_World->AddComponent<Components::Listener>(tank);
|
||||||
auto health = m_World->AddComponent<Components::Health>(tank);
|
auto health = m_World->AddComponent<Components::Health>(tank);
|
||||||
health->Amount = 100.f;
|
health->Amount = 100.f;
|
||||||
m_World->AddComponent<Components::Listener>(tank);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -535,6 +538,8 @@ EntityID Systems::TankSteeringSystem::CreateTank(int playerID)
|
|||||||
transform->Orientation = glm::quat(glm::vec3(-glm::radians(5.f), 0.f, 0.f));
|
transform->Orientation = glm::quat(glm::vec3(-glm::radians(5.f), 0.f, 0.f));
|
||||||
auto cameraComp = m_World->AddComponent<Components::Camera>(cameraTower);
|
auto cameraComp = m_World->AddComponent<Components::Camera>(cameraTower);
|
||||||
cameraComp->FarClip = 2000.f;
|
cameraComp->FarClip = 2000.f;
|
||||||
|
|
||||||
|
|
||||||
/*auto follow = m_World->AddComponent<Components::Follow>(cameraTower);
|
/*auto follow = m_World->AddComponent<Components::Follow>(cameraTower);
|
||||||
follow->Entity = barrel;
|
follow->Entity = barrel;
|
||||||
follow->Distance = 15.f;
|
follow->Distance = 15.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user