Before starting this tutorial, make sure you have followed the Get started guide which sets up the FPS Starter Project. This tutorial follows on from that guide.
You will add health pack pick-ups to the game. These health pack pick-ups are subject to the following design constraints:
- The pick-ups have static positions in the game world and are present in the world at start-up time.
- A pick-up grants health to a single player which walks over them.
- After the health pack is consumed, it is no longer visible to clients and no longer grants health.
- After a period of time, the health pack is "respawned" and is available to be picked up again.
- Critical interactions like: collision detection between the player and the health pack and granting the health is done on the game logic worker. That is to say, we do not trust the client.
- (Optional) Players which have full health cannot pick up the health packs.
To implement this feature you will:
- Add a new SpatialOS component to hold the state of the health packs.
- Define a new SpatialOS entity template called
HealthPickupentities to the snapshot so they are loaded in the SpatialOS world at startup.
- Write game logic such that the health packs grant health to players.
- Write game logic to "respawn" health packs after they have been consumed.
- Launch your Unity Editor.
- It should automatically detect the project but if it doesn't, select Open and then select
Updated 11 months ago