Thursday, 10 December 2015

Dressing Scripts

For our latest game, we automate scenery dresssing, which I'll cover in overview in another post. But today we made color modifications to various items of scenery.

Here are the trees, made from multiple source sprites



When these are placed down in the scene, the code searches for any scripts derived from DressingBase and runs that code on the objects.
We have all kinds of scripts to modify things, but here's the colour modifier script for the trees:


It simply lists the sprite renderers which are to be modified, and changes their colors. In this case we use a green gradient to colour the trees per-tree (rather than per-renderer).

The result we get when putting the trees in to the scene is this:


This also has other randomization applied, but you can see the trees have a nice variation in color now.

Depending on the game, we might use a palette database for this colorization, so we can tint everything in the level depending on other factors, like time of day, or time of year.




1 comment:

  1. That's pretty cool, makes me even more eager to switch to Unity!

    ReplyDelete