GL - explosive crate testing
This commit is contained in:
parent
bab3af787c
commit
25b0162b59
|
@ -95,9 +95,16 @@ using namespace GameLogic;
|
|||
{
|
||||
int forceThreashHold = 200000; //how much force for the box to explode of the impact
|
||||
|
||||
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
||||
|
||||
if(kineticEnergyLoss > forceThreashHold)
|
||||
switch (realObj->GetObjectType())
|
||||
{
|
||||
case ObjectSpecialType::ObjectSpecialType_Generic:
|
||||
break;
|
||||
case ObjectSpecialType::ObjectSpecialType_StandardBox:
|
||||
|
||||
break;
|
||||
case ObjectSpecialType::ObjectSpecialType_Player:
|
||||
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
||||
|
||||
|
||||
|
@ -107,7 +114,20 @@ using namespace GameLogic;
|
|||
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
||||
|
||||
delete hitSphere;
|
||||
break;
|
||||
}
|
||||
/*if(kineticEnergyLoss > forceThreashHold)
|
||||
{
|
||||
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
||||
|
||||
|
||||
Oyster::Math::Float3 pos = rigidBodyCrate->GetState().centerPos;
|
||||
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,crate->ExplosionRadius);
|
||||
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
||||
|
||||
delete hitSphere;
|
||||
}*/
|
||||
}
|
||||
|
||||
void ExplosiveCrate::Explode(Oyster::Physics::ICustomBody *obj, void* args)
|
||||
|
@ -123,7 +143,7 @@ using namespace GameLogic;
|
|||
{
|
||||
Player *hitPlayer = (Player*)realObj;
|
||||
|
||||
hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
|
||||
//hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
|
||||
//do shredding damage
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ Game::PlayerData::PlayerData()
|
|||
//sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
|
||||
|
||||
//create rigid body
|
||||
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCharacter(2.0f, 0.5f, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||
rigidBody->SetAngularFactor(0.0f);
|
||||
//create player with this rigid body
|
||||
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0);
|
||||
|
||||
this->player->GetRigidBody()->SetCustomTag(this);
|
||||
//this->player->GetRigidBody()->SetCustomTag(this);
|
||||
player->EndFrame();
|
||||
}
|
||||
Game::PlayerData::PlayerData(int playerID,int teamID)
|
||||
|
|
|
@ -57,11 +57,7 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
|||
break;
|
||||
case ObjectSpecialType_StandardBox:
|
||||
{
|
||||
int dmg = 50;
|
||||
Oyster::Math::Float force = 50;
|
||||
int radie = 10;
|
||||
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID++, dmg, force, radie);
|
||||
//gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
|
||||
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
|
||||
}
|
||||
break;
|
||||
case ObjectSpecialType_RedExplosiveBox:
|
||||
|
|
|
@ -17,20 +17,6 @@ Player::Player()
|
|||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||
{
|
||||
this->rigidBody = rigidBody;
|
||||
|
||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
||||
|
||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
||||
Oyster::Math::Float mass = 60;
|
||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
||||
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
||||
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
|
||||
|
||||
|
||||
this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||
this->rigidBody->SetAngularFactor(0.0f);
|
||||
|
||||
weapon = new Weapon(2,this);
|
||||
|
||||
this->life = 100;
|
||||
|
@ -52,20 +38,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)
|
|||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||
{
|
||||
this->rigidBody = rigidBody;
|
||||
|
||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
||||
|
||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
||||
Oyster::Math::Float mass = 60;
|
||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
||||
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
||||
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
|
||||
|
||||
|
||||
this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||
this->rigidBody->SetAngularFactor(0.0f);
|
||||
|
||||
weapon = new Weapon(2,this);
|
||||
|
||||
this->life = 100;
|
||||
|
@ -81,7 +53,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustom
|
|||
this->moveDir = Oyster::Math::Float3(0,0,0);
|
||||
this->moveSpeed = 100;
|
||||
this->previousMoveSpeed = Oyster::Math::Float3(0,0,0);
|
||||
|
||||
}
|
||||
|
||||
Player::~Player(void)
|
||||
|
|
Loading…
Reference in New Issue