Kinect小小玩偶游戏----小小潜水员

来源:互联网 发布:可以领淘宝优惠券的群 编辑:程序博客网 时间:2024/05/01 15:52

本文章由cartzhang编写,转载请注明出处。 所有权利保留。 

文章链接: http://blog.csdn.net/cartzhang/article/details/44939887

作者:cartzhang


Kinect小小玩偶游戏----小小潜水员

一、游戏说明

      通过Kinect控制小玩偶来玩Unreal游戏,左右手抬起可左右移动;右手举过头顶,可跳起;还可以发射蜗牛子弹来攻击小鱼。使用UE42D效果来实现。

  先睹为快,萌萌哒的小小主角:


二、主要的实现接口

头文件:

 

UFUNCTION(BlueprintCallable, Category = KINECTUE)void  HandState(const int32 HandType);UFUNCTION(BlueprintCallable, Category = KINECTUE)void StartCheckHandsPushDriveHand();UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "Right Hand Push"))virtual void RightHandPush();UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "Left Hand Push"))virtual void LeftHandPush();UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "Left Hand Move"))virtual void LeftHandMoveLeft();UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "Right Hand Move"))virtual void RightHandMoveRight();void   RightHandOverHeadForJump();

实现文件,cpp文件:

 

void ATwoDPaperCharacter::HandState(const int32 HandType){int iFlag = UDKinectHandsReachOutGesture(0, HandType);if (GEngine && iFlag == 1){const float fMoveSpeed = 1.0f;switch (HandType){case 1:LeftHandMoveLeft();break;case 2:RightHandMoveRight();break;default:break;}}}void ATwoDPaperCharacter::StartCheckHandsPushDriveHand(){int iRightFlag = UDKinectRightHandPushGesture(USER_INDEX);if (iRightFlag == 1){RightHandPush();}int iLeftFlag = UDKinectLeftHandPushGesture(USER_INDEX);if (iLeftFlag == 1){LeftHandPush();}}void ATwoDPaperCharacter::RightHandOverHeadForJump(){int iRightHandOverHeadFlag = UDKinectRightHandOverHeadGesture(0);if (GEngine && iRightHandOverHeadFlag == 1){FString TmpString = "Right Hand Over Head now...";//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TmpString);Jump();}}



三、Blueprint 实现截图(部分)

  其中逻辑控制,只展示部分。因为太多了,各个函数也复杂。

  下图为受到攻击的Blueprint。

下面为控制的BP。

发射蜗牛导弹的射击Blueprint。


四、游戏截图 

     主要包括,左右移动,跳起,左边发射攻击,右边发射子弹攻击,被小鱼咬到的受伤级别。



上面两张图,可看到小潜水员受到小鱼的攻击而变化了颜色。

其中,根据受伤程度不同,共有6种颜色变换。


小小潜水员在向左右发射蜗牛导弹,来攻击小鱼。


五、游戏视频

     视频已经上传到Youku.

     地址如下:http://v.youku.com/v_show/id_XOTI4NjUyMzIw.html

Kinect小小超级玩偶--小小潜水员



THE END!
---------------

若有问题,请随时联系。
非常感谢!

 


0 0
原创粉丝点击