Reader small image

You're reading from  Game Development Patterns with Unity 2021 - Second Edition

Product typeBook
Published inJul 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800200814
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
David Baron
David Baron
author image
David Baron

David Baron is a game developer with over 15 years of experience in the industry. He has worked for some well-known AAA, mobile, and indie game studios in Montreal, Canada. His skill set includes programming, design, and 3D art. As a programmer, he has worked on various games for various platforms, including virtual reality, mobile, and consoles.
Read more about David Baron

Right arrow

Defining character states

In our game, the entity that will transition between states the most is our racing bike. It's under the player's control; it interacts with almost every element in the environment, including obstacles and enemy drones. Therefore, it will never stay in the same state for long. 

The following diagram showcases a shortlist of finite states for our bike:

Figure 5.2 – Diagram illustrating the finite states of the bike

And now let's define some expected behaviors for some of the listed states:

  • Stop: In this state, the bike is not moving. Its current speed is at zero. Its gears are set to neutral. If we decide that the engine should be on, but running in idle mode in that state, we could have an animation of the chassis of the bike vibrating to show that the motor is running.
  • Start: In this state, the bike moves at full speed, and the wheels turn to match the forward motion.
  • Turn: In the turning state, the bike turns to the left or...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Game Development Patterns with Unity 2021 - Second Edition
Published in: Jul 2021Publisher: PacktISBN-13: 9781800200814

Author (1)

author image
David Baron

David Baron is a game developer with over 15 years of experience in the industry. He has worked for some well-known AAA, mobile, and indie game studios in Montreal, Canada. His skill set includes programming, design, and 3D art. As a programmer, he has worked on various games for various platforms, including virtual reality, mobile, and consoles.
Read more about David Baron