如何在SceneKit中构建多级游戏 [英] How to build a multilevel game in SceneKit

查看:44
本文介绍了如何在SceneKit中构建多级游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发人员,已完成许多商务应用程序.前段时间,我决定尝试使用SceneKit为iPad编写3D游戏.我了解如何创建SCNView和SCNScene实例以及如何从.dae文件加载场景,但是我在理解场景转换逻辑时遇到了麻烦.

I'm an iOS developer and have plenty of business apps done. Some time ago I decided to try and write a 3D game for iPad using SceneKit. I understand how to create SCNView and SCNScene instances and how to load my scene from .dae files, but I'm having trouble understanding scene transition logic.

有人可以解释一下SceneKit中不同游戏关卡之间转换的逻辑.我尚未找到SCNView和SCNScenes之间的任何过渡方法

Could someone explain the logic of transitioning between different game levels in SceneKit. I haven't found any transition methods between SCNView and SCNScenes

例如:我有2个游戏等级(SCNScene实例).玩家完成第一个关卡的播放后,我将显示分数视图(可能是SpriteKit叠加层),之后,我想加载玩家角色添加的统计信息(例如).毕竟,应该显示游戏的第二级.

For example: I have 2 levels of game (SCNScene instances). After the player finishes playing the first level, I show the score view (SpriteKit overlay probably), and after that I want to load player character adding stats (for example). After all that, the second level of the game should show.

SceneKit中什么样的架构概念可用于连续加载不同级别?我应该在SCNView之间进行转换还是需要在视图控制器之间使用基本的转换(即2个级别封装在不同的View Controller中,每个级别都有一个SCNView)?

What architectural concept works in SceneKit for loading different levels in succession? Should I transition between SCNView or do I need to use a basic transition between view controllers (i.e., 2 levels packed in different View Controllers with a SCNView in each)?.

如果我有以下场景:主菜单",应用内购买商店",玩家选择英雄"等,那么在游戏场景和这些场景之间进行转换时应该使用什么概念?.

And if I have the scenes: "Main Menu", "In-App Purchase Store", "Select Player Hero", etc, what concept should I use to transition between the game scene and these?.

到目前为止,我所看到的所有示例都基于1场景游戏(香蕉",狐狸苹果" WWDS示例).

So far all examples I have seen are based around a 1-scene game ("Banana", "Fox Apple" WWDS examples).

我将不胜感激任何有助于我理解的帮助/信息/链接.谢谢.

I would appreciate any help/info/links that will help me to understand. Thank you.

推荐答案

在iOS 9和OS X 10.11上, SCNSceneRenderer 上有一个新方法可以满足您的要求: -presentScene:withTransition:incomingPointOfView:completionHandler:.

On iOS 9 and OS X 10.11 there's a new method on SCNSceneRenderer that does what you want: -presentScene:withTransition:incomingPointOfView:completionHandler:.

在以前的版本中,您确实可以在SpriteKit中构建过渡,并在重新配置SceneKit场景时将其显示在SpriteKit叠加层中.或者,您可以使用UIKit并使用动画在两个视图之间进行交换.

On previous versions you can indeed build a transition in SpriteKit and display it in the overlay SpriteKit scene while reconfiguring the SceneKit scene. Or you could use UIKit and use animations to swap between two views.

这篇关于如何在SceneKit中构建多级游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆