x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
Soldier.cpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\C2Template\Soldier.cpp
旋转
特效
属性
历史版本
#include "Soldier.h" //#include "RigidEntity.h" #include "Tank.h" #include "..\GameScene.h" Soldier::Soldier():SkinnedEntity("marine","Bip01_Pelvis",0.35f,1.2f),mIsAlive(true){ mRunningAnim = GetAnimation("run_forward"); myassert(mRunningAnim!=NULL); mIdleAnim = GetAnimation("idle_stand"); myassert(mIdleAnim!=NULL); mShotAnim = GetAnimation("reload"); myassert(mShotAnim!=NULL); Stop(); mMovingSpeed = 2.0f; GameScene::GetSingleton()->GetPhysicsScnene()->setUserContactReport(this);//TODO: change to AddContactReport! } Soldier::~Soldier(){ //nothing. int aa=0;//to change virtual function pointer } void Soldier::Die(const Vec3& direction){ if (mIsAlive){ SetRagdollMode(true,direction); mIsAlive = false; } } void Soldier::MoveTo(const Vec3& position){ if (mIsAlive){ SkinnedEntity::MoveTo(position); SetAnimation(mRunningAnim); } } void Soldier::Stop(){ if (mIsAlive) SetAnimation(mIdleAnim); } void Soldier::GotFocus(){ if (mIsAlive && !isMoving) SetAnimation(mShotAnim); } void Soldier::LostFocus(){ if (mIsAlive && !isMoving) SetAnimation(mIdleAnim); } void Soldier::IsCollided(PhysicalEventHandler* byWho, const Vec3& hitPosition, const Vec3& hitNormal){ //RigidEntity* ridObj = dynamic_cast
(byWho); //if (ridObj!=NULL){ // //ridObj->SetPosition(ridObj->GetPosition()) // //TODO: push object here //} } void Soldier::onContactNotify(NxContactPair & pair, NxU32 events){ for (int i=0;i<2;i++){ PhysicalEventHandler* physHandler = static_cast
(pair.actors[i]->userData); Soldier* soldier = dynamic_cast
(physHandler); if (soldier!=NULL){ PhysicalEventHandler* physHandler2 = static_cast
(pair.actors[1-i]->userData); Tank* tank = dynamic_cast
(physHandler2); if (tank!=NULL){ Real curAngle= tank->GetOrientation().getRoll().valueRadians(); Vec3 force(-sinf(curAngle),+cosf(curAngle),0.0f); //Vec3 force = pair.sumNormalForce; force = force.normalisedCopy()*10.0f; soldier->Die(force); //soldier->Die(Vec3(0,0,0)); } } } }
Soldier.cpp
网页地址
文件地址
上一页
16/19
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.