mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 12:13:46 +00:00
Adds some in-progress gameObject recreation of various legacy game classes, such as PlayerObject, AIPlayerObject, Sound Emitter and Static Shape.
This commit is contained in:
parent
e0627973fb
commit
f3e04751b6
23 changed files with 792 additions and 35 deletions
68
Engine/source/T3D/gameObjects/staticShapeObject.cpp
Normal file
68
Engine/source/T3D/gameObjects/staticShapeObject.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#include "staticShapeObject.h"
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(StaticShapeObject);
|
||||
|
||||
StaticShapeObject::StaticShapeObject()
|
||||
: mMeshComponent(nullptr),
|
||||
mCollisionComponent(nullptr),
|
||||
mAnimationComponent(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
StaticShapeObject::~StaticShapeObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool StaticShapeObject::onAdd()
|
||||
{
|
||||
if (!Parent::onAdd())
|
||||
return false;
|
||||
|
||||
//If we don't delinate from the template, just spawn as apropos here
|
||||
if (!mDirtyGameObject)
|
||||
{
|
||||
//Mesh
|
||||
mMeshComponent = new MeshComponent();
|
||||
if (!mMeshComponent->registerObject())
|
||||
{
|
||||
Con::errorf("StaticShapeObject::onAdd - unable to add MeshComponent!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mMeshComponent->setInternalName("meshComponent");
|
||||
|
||||
addComponent(mMeshComponent);
|
||||
|
||||
//Collision
|
||||
mCollisionComponent = new ShapeCollisionComponent();
|
||||
if (!mCollisionComponent->registerObject())
|
||||
{
|
||||
Con::errorf("StaticShapeObject::onAdd - unable to add ShapeCollisionComponent!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mCollisionComponent->setInternalName("collisionComponent");
|
||||
|
||||
addComponent(mCollisionComponent);
|
||||
|
||||
//Animation
|
||||
mAnimationComponent = new AnimationComponent();
|
||||
if (!mAnimationComponent->registerObject())
|
||||
{
|
||||
Con::errorf("StaticShapeObject::onAdd - unable to add AnimationComponent!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mAnimationComponent->setInternalName("animationComponent");
|
||||
|
||||
addComponent(mAnimationComponent);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void StaticShapeObject::onRemove()
|
||||
{
|
||||
Parent::onRemove();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue