diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index 1e5d0640..86560164 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -38,18 +38,14 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS: ForcePush(usage,dt); break; + case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS: - - if(hasObject) - { - //ForcePush(usage,dt);//WARNING THIS IS A CRAP TEST TO MAKE SURE YOU CAN SHOOT BOXES - break; - } ForcePull(usage,dt); - break; + break; + case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS: ForceZip(usage,dt); - break; + break; } } @@ -117,12 +113,9 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float ********************************************************/ void AttatchmentMassDriver::ForceZip(const WEAPON_FIRE &usage, float dt) { - Oyster::Physics::Struct::CustomBodyState state = this->owner->GetRigidBody()->GetState(); + Oyster::Math::Float3 force = Oyster::Math::Float4(this->owner->GetLookDir()) * (1000); - //do something with state - //state.ApplyLinearImpulse(Oyster::Math::Float3(this->owner->GetLookDir()) * (500 * dt)); - - this->owner->GetRigidBody()->SetState(state); + this->owner->GetRigidBody()->ApplyImpulse(force); } diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 9aef6b6c..857c135c 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -7,6 +7,7 @@ #include "Game.h" #include "CollisionManager.h" #include "JumpPad.h" +#include "Portal.h" using namespace Oyster; @@ -14,6 +15,7 @@ using namespace GameLogic; void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss); void SendObjectFlying(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 force); + void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target); //Physics::ICustomBody::SubscriptMessage void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) @@ -63,6 +65,20 @@ using namespace GameLogic; { obj.ApplyImpulse(force); } + + void Portal::PortalActivated(Oyster::Physics::ICustomBody *rigidBodyPortal, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + { + Portal *portal = (Portal*)(rigidBodyPortal->GetCustomTag()); + + if(obj->GetState().mass == 0) return; + + Teleport(*obj,portal->portalExit); + } + + void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target) + { + obj.SetPosition(target); + } void PlayerVObject(Player &player, Object &obj, Oyster::Math::Float kineticEnergyLoss) diff --git a/Code/Game/GameLogic/CrystalFormation.cpp b/Code/Game/GameLogic/CrystalFormation.cpp new file mode 100644 index 00000000..00709660 --- /dev/null +++ b/Code/Game/GameLogic/CrystalFormation.cpp @@ -0,0 +1,20 @@ +#include "CrystalFormation.h" + +using namespace GameLogic; + +CrystalFormation::CrystalFormation(void) + :StaticObject() +{ + this->shreddingDamage = 0; +} + +CrystalFormation::CrystalFormation(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type, Oyster::Math::Float shreddingDamage) + :StaticObject(rigidBody, collisionFuncAfter, type) +{ + this->shreddingDamage = shreddingDamage; +} + + +CrystalFormation::~CrystalFormation(void) +{ +} diff --git a/Code/Game/GameLogic/CrystalFormation.h b/Code/Game/GameLogic/CrystalFormation.h new file mode 100644 index 00000000..693460fe --- /dev/null +++ b/Code/Game/GameLogic/CrystalFormation.h @@ -0,0 +1,21 @@ +#ifndef CRYSTALFORMATION_H +#define CRYSTALFORMATION_H +#include "StaticObject.h" +namespace GameLogic +{ + class CrystalFormation : public StaticObject + { + public: + CrystalFormation(void); + + CrystalFormation(Oyster::Physics::ICustomBody *rigidBody + ,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss) + ,OBJECT_TYPE type, Oyster::Math::Float shreddingDamage); + + ~CrystalFormation(void); + + private: + Oyster::Math::Float shreddingDamage; + }; +} +#endif \ No newline at end of file diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 7ae78fac..b19ffef0 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -192,6 +192,7 @@ + @@ -215,6 +216,7 @@ + diff --git a/Code/Game/GameLogic/Portal.cpp b/Code/Game/GameLogic/Portal.cpp new file mode 100644 index 00000000..ac44d529 --- /dev/null +++ b/Code/Game/GameLogic/Portal.cpp @@ -0,0 +1,22 @@ +#include "Portal.h" + +using namespace GameLogic; +using namespace Oyster::Math; + +Portal::Portal(void) + :StaticObject() +{ + this->portalExit = Float3(0,0,0); +} + +Portal::Portal(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type, Oyster::Math::Float3 portalExit) + :StaticObject(rigidBody, collisionFuncAfter, type) +{ + this->portalExit = portalExit; +} + +Portal::~Portal(void) +{ + +} + diff --git a/Code/Game/GameLogic/Portal.h b/Code/Game/GameLogic/Portal.h new file mode 100644 index 00000000..5b31c8b5 --- /dev/null +++ b/Code/Game/GameLogic/Portal.h @@ -0,0 +1,23 @@ +#ifndef PORTAL_H +#define PORTAL_H +#include "StaticObject.h" +namespace GameLogic +{ + class Portal : public StaticObject + { + public: + Portal(void); + + Portal(Oyster::Physics::ICustomBody *rigidBody + ,void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss) + ,OBJECT_TYPE type, Oyster::Math::Float3 portalExit); + + ~Portal(void); + + static void PortalActivated(Oyster::Physics::ICustomBody *rigidBodyPortal, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); + + private: + Oyster::Math::Float3 portalExit; + }; +} +#endif \ No newline at end of file