WyrmTale Games
$30.00 USD
$35.00 USD
$25.00 USD
FREE
$25.00 USD
$35.00 USD
Navigation : www.wyrmtale.com / orthello / code integration
Search :
search

Integrating your code

| User Guide Contents | Download Orthello | C# Class Reference | Asset store link |


Integrating your code

When you are creating a game or an application using Unity3D it will be impossible to avoid some coding of yourself. Orthello supports C# and JS (Javascript) code integration.

To integrate your code you can :

  • Use the Orthello API to control your system, sprite sheets, animations and sprites.

    Many orthello objects have methods and properties that you can use to control these objects by code. By using these publicly available class members it even is possible to build your entire application by code.

    You can find information about the Orthello API in the C# class reference.

    The most commenly used classed are :

    • OT system object
      This object is used to find objects quickly, to control your orthographic view (camera), to create and destroy objects from prototypes. To cache, and query cached materials. The OT object is used as a static class. This means that you will use the main class OT reference to access properties and methods.

      Check 'Using the static OT system object' for more in depth information.
    • OTObject class
      This object is the base object class for most of the Orthello display objects (like sprites). You wil be, for example, using OTObject.InitCallBacks(script) when setting up the object to deliver JS callbacks, or {object}.outOfView to check if an sprite is out of the camera view. and more...

      When working with a specific display object, like a sprite or a Sprite subclass like AnimatingSprite, one could always typecast an OTObject to this class and use its specific properties and methods as well.
  • Use C# delegates or JS callback functions to handle Orthello events.

    In some situation, the Orthello framework can send notifications when specific events happen. Because Orthello was written in C#, it supports the delegate model for C# event handling. This means that most classes, that can send event notifications, have delegate variables that can be set using code.

    When creating your game or application using Javascript, these C# delegates can not be accessed. There is however, another way. It is possible to let an OTObject (or subclass) know that you want to receive callbacks using the OTObject.InitCallBacks(script). By calling this function, the OTObject will try to call the 'public' callback function, on the specific class instance you provide, when a specific event happens. This technique can also be used when coding in C#. Just be sure you , !IMPORTANT create the callback functions/methods as being public.

To get Javascript coding working

  • !IMPORTANT  When coding in JS ( Javascript ) , make sure you move the folder

    • [Project root]/Orthello/Standard Assets
    to
    • [Project root]/Standard Assets. 

If you don't, you will definitely get compiler errors, as the C# classes will not be accessible to your JS code.
( type not found )

In addition, all JS code samples have been commented to avoid compiling  errors on importing Orthello packages due to the Standard Assets Folder location  mentioned above.

To execute a JS example :

  1. Make sure /Orthello/Standard Assets is moved to /Standard assets.
  2. Open favoured JS code example scene.
  3. Remove the /* and */ comment delimiters from all JS example units.
  4. Run your example.


| Previous : Working with animations | Next : Handling collisions |

WyrmTale Games
de Vinkenslag 22
5258 KX Berlicum (NB)
The Netherlands
info@wyrmtale.com
| Privacy Policy | Disclaimer |



WyrmTale Games is a Ruach Interactive B.V. Division.
KvK nr. 17244071 - VAT nr. NL8204.66.633.B01
 
Inline