Skip to content

Latest commit

 

History

History
73 lines (39 loc) · 3.59 KB

README-Examples.md

File metadata and controls

73 lines (39 loc) · 3.59 KB

Examples

We provide a set of example scenes which demonstrate various ways to use the SDK. These range from simply dumping out raw data to a small puzzle game using Coding tiles. Explore, mangle, and poke at these to your heart's content.

1. Basic Example

Examples/BasicExample/BasicExampleScene.unity

A simple example of dumping out values seen by the computer vision to screen. Swap out the Deck of the TangibleManager on the scene to use different types of tiles.

In our Update() call of Tangible.SDKExamples.BasicExample.Game you will see we use the current AliveObjects list pulled from the singleton instance of TangibleManager.

basic_example

2. Basic Numbers

Examples/BasicSetupExample/BasicSetupScene.unity

In this example, we subscribe to the events OnObjectEnter and OnObjectExit from the TangibleManager. In the case of subtraction, we also register for the event OnLocationChanged because we need to order by X position when tiles move (even if no new tiles enter or exit the play area)

example_basic_numbers

3. Basic Words

Examples/BasicWords/BasicWordsScene.unity

An example of a game which only registers with OnObjectEnter. Once a letter has been detected, the game treats it as guessed. OnObjectExit is ignored because letters cannot be unguessed.

example_basic_words

4. Timeline Game

Examples/TimelineGame/TimelineScene.unity

An example game using domino codes. It uses a custom deck (which ignores domino code values that are not used by the game). To play this on device, print out a set of domino codes from dominocodes.pdf in the Readme directory of the SDK.

In order to make your own custom decks, see the Customizing Deck section.

example_timeline_game

5. Coding Painting

Examples/CodingPainting/CodingPaintingScene.unity

See the Testing In-Editor section for how to play in-editor with Coding tiles.

The game of life, using coding tiles to seed different species on the board.

This game uses Coding tiles, and the ClusterManager. It uses the most simple decision of what cluster to use by always choosing the largest one.

The ClusterManager subscribes to the OnUpdatedTangibleObjects event which fires an event every time the computer vision returns with a new set of data. The rate at which this happens is not the same as your Unity update rate. It’s generally 10-20 times per second on a newer iPad.

See CodingClusterService for how the game decides what is in a cluster and what is not.

example_coding_painting

6. Coding Valley

Examples/CodingValley/CodingValleyScene.unity

See the Testing In-Editor section for how to play in-editor with Coding tiles.

An example of a more complete small puzzle game using the Coding tiles.

example_coding_valley

7. Example Selector

Examples/ExampleSelector/ExampleSelectorScene.unity

Use this scene if you want to select between the above example scenes.

NOTE: If you want to switch between different decks at runtime, let us know. We can give you examples of how to do this properly. This Example Selector is a dumb picker and will only load scenes so it does not swap back/forth between different decks at runtime. Close the app to select a new scene.

In order to have this work, you will need to add all of the scenes in your File -> Build Settings -> Scenes in Build list.

example_selector