Learn Unity 4 for iOS Game Development by Philip Chu
Author:Philip Chu
Language: eng
Format: epub, mobi, pdf
Publisher: Apress, Berkeley, CA
At some point, the SmoothFollow and FuguForce scripts have to be reenabled. The natural place to do that is in the ResetCamera and ResetBall functions (Listing 8-23), as they get called when a roll is over and the Main Camera and Ball, respectively, are reset to start another roll.
Listing 8-23. ResetBall and ResetCamera Functions in FuguBowl.js
function ResetBall() {
ball.GetComponent(FuguForce).enabled = true;
ball.SendMessage("ResetPosition");
}
function ResetCamera() {
var follow:Behaviour = Camera.main.GetComponent("SmoothFollow");
if (follow != null) {
follow.enabled = true;
}
Camera.main.SendMessage("ResetPosition");
}
In both the ResetBall and ResetCamera functions, the code to enable the script Component is the same one used to disable the script, except the enabled variable is set to true.
After disabling both the FuguForce and SmoothFollow scripts, StateRolledPast waits five seconds before transitioning to the next state, StateRollOver, allowing time for the Ball to roll into the pins (or past the pins). A while loop that calls yield until the desired amount of time has passed (by checking Time.time) would do the trick, but it’s much more convenient to call yield on the function WaitForSeconds, which takes a number of seconds as an argument (in StateRolledPast, the number of seconds is hardcoded to 5, but it could easily be a public variable to allow customization). As a result, the coroutine StateRolledPast will essentially pause (without blocking execution in the rest of Unity) until the given time has elapsed.
Download
Learn Unity 4 for iOS Game Development by Philip Chu.mobi
Learn Unity 4 for iOS Game Development by Philip Chu.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12563)
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Dependency Injection in .NET by Mark Seemann(9335)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7016)
Microservices with Go by Alexander Shuiskov(6783)
Practical Design Patterns for Java Developers by Miroslav Wengner(6696)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6636)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6045)
The Art of Crafting User Stories by The Art of Crafting User Stories(5575)
NetSuite for Consultants - Second Edition by Peter Ries(5508)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5309)
Kotlin in Action by Dmitry Jemerov(5061)
