if you buy something its earns income
over time
That’s precisely what the example above demonstrates. As soon as you spawn the actor with the above script and start the aforementioned event, the Money integer will accumulate value over time.
To expand on this a little, lets say this is your tycoon building represented by an actor:
It makes a random 1-5 Money every 1s. It will then execute a [dispatcher][2] call to notify everyone that it has produced something. And we will print the value so we can see how much was made.
And you will have some kind of manager actor that is responsible for adding new building and counting what they produce:
- here, we spawn 25 buildings
- register their dispatcher calls
- and count the money they generate (upper left corner)
That’s the gist. The entire setup would be more convoluted, of course.