Skip to content
Alexander Scheurer edited this page Feb 14, 2014 · 5 revisions

Structure: Target

Our Targets need the following abilities: know their state (active/inactive) and change their own shader. The code is there for you to look at and it only uses functionality we implemented over the course of this tutorial. So I challange you to try this yourself, this shouldn't take you more then 5 minutes. Compare your code to mine and if yours is better don't hesitate sending a pull request!

In the end you should be able to test your target, in our GameWorld, like this:

if ((_player.GetPositionVector() - target.GetPositionVector()).length < someDistance)
   target.SetActive()

This is a bare bone simplification, the actual implementation should scale to however many targets you choose to put into the scene.

[> Lesson 09 - GameStates](Lesson 09)

Clone this wiki locally