A gate and better bridges.

This commit is contained in:
2014-06-04 05:47:29 +02:00
parent 3c17ab6037
commit 62dd85349f
3 changed files with 34 additions and 31 deletions
+1 -1
Submodule assets updated: 637f866e2d...c2ee1b0198
+17 -14
View File
@@ -513,12 +513,15 @@ void GameWorld::BindGamepadButton(Gamepad::Button button, std::string command, f
EventBroker->Publish(e); EventBroker->Publish(e);
} }
void GameWorld::CreateGate(glm::vec3 Position) void GameWorld::CreateGate(EntityID parent, glm::vec3 position, glm::quat orientation)
{ {
auto gateParent = CreateEntity(parent);
auto transform = AddComponent<Components::Transform>(gateParent);
transform->Position = position;
transform->Orientation = orientation;
{ {
auto gateBase = CreateEntity(); auto gateBase = CreateEntity(gateParent);
auto transform = AddComponent<Components::Transform>(gateBase); auto transform = AddComponent<Components::Transform>(gateBase);
transform->Position = Position;
auto model = AddComponent<Components::Model>(gateBase); auto model = AddComponent<Components::Model>(gateBase);
model->ModelFile = "Models/Gate/Lift/Lift.obj"; model->ModelFile = "Models/Gate/Lift/Lift.obj";
auto physics = AddComponent<Components::Physics>(gateBase); auto physics = AddComponent<Components::Physics>(gateBase);
@@ -577,10 +580,9 @@ void GameWorld::CreateGate(glm::vec3 Position)
CommitEntity(gateBase); CommitEntity(gateBase);
} }
auto gate = CreateEntity(gateParent);
{ {
auto gate = CreateEntity();
auto transform = AddComponent<Components::Transform>(gate); auto transform = AddComponent<Components::Transform>(gate);
transform->Position = Position;
auto model = AddComponent<Components::Model>(gate); auto model = AddComponent<Components::Model>(gate);
model->ModelFile = "Models/Gate/Gate/Gate.obj"; model->ModelFile = "Models/Gate/Gate/Gate.obj";
auto physics = AddComponent<Components::Physics>(gate); auto physics = AddComponent<Components::Physics>(gate);
@@ -588,8 +590,8 @@ void GameWorld::CreateGate(glm::vec3 Position)
physics->CollisionLayer = (int)Components::Physics::CollisionLayer::STATIC; physics->CollisionLayer = (int)Components::Physics::CollisionLayer::STATIC;
auto move = AddComponent<Components::Move>(gate); auto move = AddComponent<Components::Move>(gate);
move->Speed = 5.f; move->Speed = 5.f;
move->GoalPosition = glm::vec3(Position.x, Position.y + 9.02345f, Position.z); move->GoalPosition = glm::vec3(0, 9.02345f, 0);
move->StartPosition = glm::vec3(Position.x, Position.y, Position.z); move->StartPosition = glm::vec3(0, 0, 0);
{ {
auto mainShape = CreateEntity(gate); auto mainShape = CreateEntity(gate);
auto transform = AddComponent<Components::Transform>(mainShape); auto transform = AddComponent<Components::Transform>(mainShape);
@@ -611,16 +613,16 @@ void GameWorld::CreateGate(glm::vec3 Position)
CommitEntity(lowerShape); CommitEntity(lowerShape);
} }
CommitEntity(gate); CommitEntity(gate);
}
{ {
auto gateTrigger = CreateEntity(); auto gateTrigger = CreateEntity(gateParent);
auto transform = AddComponent<Components::Transform>(gateTrigger); auto transform = AddComponent<Components::Transform>(gateTrigger);
transform->Position = glm::vec3(Position.x, Position.y + 2.8241, Position.z); transform->Position = glm::vec3(0, 2.8241, 0);
auto trigger = AddComponent<Components::Trigger>(gateTrigger); auto trigger = AddComponent<Components::Trigger>(gateTrigger);
auto triggerMove = AddComponent<Components::TriggerMove>(gateTrigger); auto triggerMove = AddComponent<Components::TriggerMove>(gateTrigger);
triggerMove->Entity = gate; triggerMove->Entity = gate;
{ {
auto shape = CreateEntity(gateTrigger); auto shape = CreateEntity(gateTrigger);
auto transform = AddComponent<Components::Transform>(shape); auto transform = AddComponent<Components::Transform>(shape);
@@ -633,8 +635,6 @@ void GameWorld::CreateGate(glm::vec3 Position)
} }
CommitEntity(gateTrigger); CommitEntity(gateTrigger);
} }
}
} }
EntityID GameWorld::CreateWall(glm::vec3 pos, glm::quat orientation) EntityID GameWorld::CreateWall(glm::vec3 pos, glm::quat orientation)
@@ -949,7 +949,7 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
auto base = CreateEntity(); auto base = CreateEntity();
auto transform = AddComponent<Components::Transform>(base); auto transform = AddComponent<Components::Transform>(base);
transform->Orientation = orientation; transform->Orientation = orientation;
#pragma region Terrain
{ {
auto ground_small = CreateEntity(base); auto ground_small = CreateEntity(base);
auto transform = AddComponent<Components::Transform>(ground_small); auto transform = AddComponent<Components::Transform>(ground_small);
@@ -1012,7 +1012,7 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
auto shape = CreateEntity(bridge_middle); auto shape = CreateEntity(bridge_middle);
auto transformshape = AddComponent<Components::Transform>(shape); auto transformshape = AddComponent<Components::Transform>(shape);
auto meshShape = AddComponent<Components::MeshShape>(shape); auto meshShape = AddComponent<Components::MeshShape>(shape);
meshShape->ResourceName = "Models/TerrainFiveIstles/Bridges/MiddleBridge.obj"; meshShape->ResourceName = "Models/TerrainFiveIstles/Bridges/MiddleBridgeCollision.obj";
CommitEntity(shape); CommitEntity(shape);
} }
CommitEntity(bridge_middle); CommitEntity(bridge_middle);
@@ -1105,6 +1105,9 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
} }
CommitEntity(bridge_base); CommitEntity(bridge_base);
} }
#pragma endregion Terrain
CreateGate(base, glm::vec3(273.f, 40.185f, 0.06f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
CreateGarage(base, glm::vec3(323.2f, 41.4f, -10.2f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), playerID); CreateGarage(base, glm::vec3(323.2f, 41.4f, -10.2f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), playerID);
} }
+1 -1
View File
@@ -78,7 +78,7 @@ private:
void BindGamepadAxis(Gamepad::Axis axis, std::string command, float value); void BindGamepadAxis(Gamepad::Axis axis, std::string command, float value);
void BindGamepadButton(Gamepad::Button button, std::string command, float value); void BindGamepadButton(Gamepad::Button button, std::string command, float value);
void CreateGate(glm::vec3 Position); void CreateGate(EntityID parent, glm::vec3 position, glm::quat orientation);
void AddTankWheelPair(EntityID tankEntity, glm::vec3 position, int axleID, bool steering); void AddTankWheelPair(EntityID tankEntity, glm::vec3 position, int axleID, bool steering);
EntityID CreateJeep(int playerID); EntityID CreateJeep(int playerID);
EntityID CreateWall(glm::vec3 pos, glm::quat orientation); EntityID CreateWall(glm::vec3 pos, glm::quat orientation);