Thursday, April 14, 2016

WWW class & Data path

Using Application.dataPath, I could find a folder within the project folder. System.IO.Directory.GetParent brought it back to the project folder; adding the file:/// and the string from the Xml created a url.

Using the WWW class, using a url to load images and sounds and the xml file from the folder or even from a website.

For the audio, I chose to use separate variables so it would be easier to reference in other scripts, rather than remembering specific element.

Slice Xml Reader

For the wheel scene, each slice will have this script on the gameObject, and each will load a specified color and icon.

I used the WWW class to link the url for the image, check for an error in the www, and place the image onto a child object of the slice.

Each slice and child object is given a Transparent/Diffuse shader to keep transparency.

In the future, I am planning to replace the urls with references to the Resourses folder, so the placement is not hard coded in. I always want to look into a more efficient way to single out nodes, rather than cycling through child nodes.

Slice Xml

For the Xml, each slice is individual in order for complete access to color and image. Each slice is given an id for script access. Soon I will add probability and, perhaps, the states of the wheel (idle/ vulnerable / secure / win).

The images will be put into the resources folder for ease of access.