Adventure Creator  1.75.0
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
AC.ScriptedActionListExample Class Reference
Inheritance diagram for AC.ScriptedActionListExample:
AC.ITranslatable

Public Member Functions

void RunExampleOne ()
 
string GetTranslatableString (int index)
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner (int index)
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer (int index)
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 

Detailed Description

This script offers two examples on how ActionList can be generated through script. To use it, place the "Scripted Action List Example" component in your scene and assign the fields in the Inspector. Once in Play mode, each example can then be run by clicking the cog icon to the top-right of the Inspector and choosing either 'Run Example 1' or 'Run Example 2'.

Note: This script implements the ITranslatable interface but this is only necessary to allow the Player's speech to be included in the Speech Manager.

Member Function Documentation

◆ CanTranslate()

bool AC.ScriptedActionListExample.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ GetNumTranslatables()

int AC.ScriptedActionListExample.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.ScriptedActionListExample.GetOwner ( int  index)

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Parameters
indexThe index of the translatable text
Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetTranslatableString()

string AC.ScriptedActionListExample.GetTranslatableString ( int  index)

The following code is only necessary because the script implements ITranslatable. This is to demonstrate how the Player's speech line can be included in the Speech Manager for translation, audio etc. If a scripted ActionList does not require this, all of the below can be left out (provided that the implemenation is also removed in the class declaration)

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.ScriptedActionListExample.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.ScriptedActionListExample.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ HasExistingTranslation()

bool AC.ScriptedActionListExample.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ OwnerIsPlayer()

bool AC.ScriptedActionListExample.OwnerIsPlayer ( int  index)

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Parameters
indexThe index of the translatable text
Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ RunExampleOne()

void AC.ScriptedActionListExample.RunExampleOne ( )

In this example, we create a linear sequence of Actions directly within the ActionList they are a part of. This sequence involves playing a simple Console message, moving the player, having him speak, and add an item to their inventory. The player's speech can also be included in the Speech Manager, but this is optional. See the ITranslatable implementation at the bottom of the script, as well as the Manual's "Custom translatables" chapter for more.

◆ SetTranslationID()

void AC.ScriptedActionListExample.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.