Adventure Creator  1.55b
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2016
AC.AdvGame Class Reference
Inheritance diagram for AC.AdvGame:

Static Public Member Functions

static void SetMixerVolume (AudioMixerGroup audioMixerGroup, string parameter, float volume)
 Sets the volume of an Audio Mixer Group (Unity 5 only). More...
 
static void AssignMixerGroup (AudioSource audioSource, SoundType soundType, bool isSpeech=false)
 Sets the 'Output Audio Mixer Group' of an Audio Source, based on its sound type (Unity 5 only). More...
 
static int GetAnimLayerInt (AnimLayer animLayer)
 Returns the integer value of the AnimLayer enum. Necessary because two Neck layers are used, though only one is present in the enum. More...
 
static References GetReferences ()
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, int parameterID=-1, int parameterValue=0)
 Runs an ActionList asset file. If the ActionList contains an Integer parameter, the parameter's value can be set here. More...
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, GameObject parameterValue)
 Runs an ActionList asset file, and sets the value of the first parameter, provided that it is a GameObject. More...
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, int parameterID, GameObject parameterValue)
 Runs an ActionList asset file, and sets the value of a parameter, provided that it is a GameObject. More...
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, int i, bool addToSkipQueue)
 Runs an ActionList asset file. More...
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, Conversation endConversation)
 Runs an ActionList asset file. More...
 
static RuntimeActionList RunActionListAsset (ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
 Runs or skips an ActionList asset file. More...
 
static RuntimeActionList SkipActionListAsset (ActionListAsset actionListAsset)
 Skips an ActionList asset file. More...
 
static RuntimeActionList SkipActionListAsset (ActionListAsset actionListAsset, int i)
 Skips an ActionList asset file. More...
 
static double CalculateFormula (string formula)
 Calculates a formula (Not available for Windows Phone devices). More...
 
static string ConvertTokens (string _text)
 Converts a string's tokens into their true values. The '[var:ID]' token will be replaced by the value of global variable 'ID'. The '[localvar:ID]' token will be replaced by the value of local variable 'ID'. More...
 
static string ConvertTokens (string _text, int languageNumber, LocalVariables localVariables=null)
 Converts a string's tokens into their true values. The '[var:ID]' token will be replaced by the value of global variable 'ID'. The '[localvar:ID]' token will be replaced by the value of local variable 'ID'. More...
 
static void DrawCubeCollider (Transform transform, Color color)
 Draws a cube gizmo in the Scene window. More...
 
static void DrawBoxCollider (Transform transform, Color color)
 Draws a box gizmo in the Scene window. More...
 
static void DrawPolygonCollider (Transform transform, PolygonCollider2D poly, Color color)
 Draws an outline of a Polygon Collider 2D in the Scene window. More...
 
static void FindObjectWithConstantID (int _constantID)
 Locates an object with a supplied ConstantID number (Unity Editor only). If the object is not found in the current scene, all scenes in the Build Settings will be searched. Once an object is found, it will be pinged in the Hierarchy window. More...
 
static string[] GetSceneFiles ()
 Returns all scene filenames listed in the Build Settings (Unity Editor only). More...
 
static int GlobalVariableGUI (string label, int variableID)
 Generates a Global Variable selector GUI (Unity Editor only). More...
 
static void DrawNodeCurve (Rect start, Rect end, Color color, int offset, bool onSide, bool isDisplayed)
 Draws a curve between two Actions in the ActionList Editor window (Unity Editor only). More...
 
static void DrawNodeCurve (Rect start, Vector2 end, Color color, int offset, bool fromSide, bool toSide, bool isDisplayed)
 Draws a curve between two Actions in the ActionList Editor window (Unity Editor only). More...
 
static void DuplicateActionsBuffer ()
 
static LayerMask LayerMaskField (string label, LayerMask layerMask)
 
static Vector3 GetScreenDirection (Vector3 originWorldPosition, Vector3 targetWorldPosition)
 Returns the vector between two world-space points when converted to screen-space.</summary?

Parameters
originWorldPositionThe first point in world-space
targetWorldPositionThe second point in world-space
Returns
The vector between the two points in screen-space

 
static Vector3 GetScreenNavMesh (Vector3 targetWorldPosition)
 Returns the percieved point on a NavMesh of a world-space position, when viewed through screen-space. More...
 
static Vector2 GetMainGameViewSize (bool accountForForcedAspectRatio=false)
 Returns the screen dimensions as a vector. More...
 
static Vector2 GetMainGameViewOffset ()
 Returns the amount by which the screen dimensions are offset as a result of an enforced aspect ratio.
Returns
The screen dimensions

 
static void ClearGameViewCache ()
 
static Matrix4x4 SetVanishingPoint (Camera _camera, Vector2 perspectiveOffset)
 Sets the vanishing point of a perspective-locked camera. More...
 
static string UniqueName (string name)
 Generates a unique name for a GameObject by adding numbers to the end of it. More...
 
static string GetName (string resourceName)
 Gets the name of an asset file, given its path. More...
 
static Rect GUIBox (float centre_x, float centre_y, float size)
 Generates a Rect from a square. More...
 
static Rect GUIBox (Vector2 posVector, float size)
 Generates a Rect from a square. More...
 
static Rect GUIRect (float centre_x, float centre_y, float width, float height)
 Generates a Rect from a rectangle. More...
 
static void PlayAnimClipFrame (Animation _animation, int layer, AnimationClip clip, AnimationBlendMode blendMode, WrapMode wrapMode, float fadeTime, Transform mixingBone, float normalisedFrame)
 Initialises and plays a legacy AnimationClip on an Animation component, starting from a set point. More...
 
static void PlayAnimClip (Animation _animation, int layer, AnimationClip clip, AnimationBlendMode blendMode=AnimationBlendMode.Blend, WrapMode wrapMode=WrapMode.ClampForever, float fadeTime=0f, Transform mixingBone=null, bool reverse=false)
 Initialises and plays a legacy AnimationClip on an Animation component. More...
 
static void CleanUnusedClips (Animation _animation)
 Cleans the supplied Animation component of any clips not being played. More...
 
static float Lerp (float from, float to, float t)
 Lerps from one float to another over time. More...
 
static Vector3 Lerp (Vector3 from, Vector3 to, float t)
 Lerps from one Vector3 to another over time. More...
 
static Quaternion Lerp (Quaternion from, Quaternion to, float t)
 Lerps from one Quaternion to another over time. More...
 
static float Interpolate (float startT, float deltaT, MoveMethod moveMethod, AnimationCurve timeCurve=null)
 Interpolates a float over time, according to various interpolation methods. More...
 
static void DrawTextEffect (Rect rect, string text, GUIStyle style, Color outColor, Color inColor, float size, TextEffects textEffects)
 Draws GUI text with an outline and/or shadow. More...
 
static string PrepareStringForSaving (string _string)
 
static string PrepareStringForLoading (string _string)
 

Static Public Attributes

static List< AC.ActioncopiedActions = new List<AC.Action>()
 

Detailed Description

A class that provides a number of useful functons for both editor and runtime.

Member Function Documentation

static void AC.AdvGame.AssignMixerGroup ( AudioSource  audioSource,
SoundType  soundType,
bool  isSpeech = false 
)
static

Sets the 'Output Audio Mixer Group' of an Audio Source, based on its sound type (Unity 5 only).

Parameters
audioSourceThe Audio Source component to affect
soundTypeThe sound type that controls the volume
isSpeechTrue if the Audio Source is used to play speech
static double AC.AdvGame.CalculateFormula ( string  formula)
static

Calculates a formula (Not available for Windows Phone devices).

Parameters
formulaThe formula string to calculate
Returns
The result
static void AC.AdvGame.CleanUnusedClips ( Animation  _animation)
static

Cleans the supplied Animation component of any clips not being played.

Parameters
_animationThe Animation component to clean
static string AC.AdvGame.ConvertTokens ( string  _text)
static

Converts a string's tokens into their true values. The '[var:ID]' token will be replaced by the value of global variable 'ID'. The '[localvar:ID]' token will be replaced by the value of local variable 'ID'.

Parameters
_textThe original string with tokens
Returns
The converted string without tokens
static string AC.AdvGame.ConvertTokens ( string  _text,
int  languageNumber,
LocalVariables  localVariables = null 
)
static

Converts a string's tokens into their true values. The '[var:ID]' token will be replaced by the value of global variable 'ID'. The '[localvar:ID]' token will be replaced by the value of local variable 'ID'.

Parameters
_textThe original string with tokens
languageNumberThe index number of the game's current language
localVariablesThe LocalVariables script to read local variables from, if not the scene default
Returns
The converted string without tokens
static void AC.AdvGame.DrawBoxCollider ( Transform  transform,
Color  color 
)
static

Draws a box gizmo in the Scene window.

Parameters
transformThe transform of the object to draw around
colorThe colour of the box
static void AC.AdvGame.DrawCubeCollider ( Transform  transform,
Color  color 
)
static

Draws a cube gizmo in the Scene window.

Parameters
transformThe transform of the object to draw around
colorThe colour of the cube
static void AC.AdvGame.DrawNodeCurve ( Rect  start,
Rect  end,
Color  color,
int  offset,
bool  onSide,
bool  isDisplayed 
)
static

Draws a curve between two Actions in the ActionList Editor window (Unity Editor only).

Parameters
startThe Rect of the Action to draw from
endThe Rect of the Action to draw to
colorThe colour of the curve
offsetHow far the line should be offset along the rect
onSideTrue if the curve should begin on the side of the Action
isDisplayedTrue if the Action to draw from is expanded
static void AC.AdvGame.DrawNodeCurve ( Rect  start,
Vector2  end,
Color  color,
int  offset,
bool  fromSide,
bool  toSide,
bool  isDisplayed 
)
static

Draws a curve between two Actions in the ActionList Editor window (Unity Editor only).

Parameters
startThe Rect of the Action to draw from
endThe point to draw to
colorThe colour of the curve
offsetHow far the line should be offset along the rect
fromSideTrue if the curve should begin on the side of the Action
toSideTrue if the curve should end on the side of the Action
isDisplayedTrue if the Action to draw from is expanded
static void AC.AdvGame.DrawPolygonCollider ( Transform  transform,
PolygonCollider2D  poly,
Color  color 
)
static

Draws an outline of a Polygon Collider 2D in the Scene window.

Parameters
transformThe transform of the object to draw around
polyThe Polygon Collider 2D
colorThe colour of the outline
static void AC.AdvGame.DrawTextEffect ( Rect  rect,
string  text,
GUIStyle  style,
Color  outColor,
Color  inColor,
float  size,
TextEffects  textEffects 
)
static

Draws GUI text with an outline and/or shadow.

Parameters
rectThe Rect of the GUI text
textThe text itself
styleThe GUIStyle that the GUI text uses
outColourThe colour of the text's outline/shadow
inColourThe colour of the text itself
sizeThe size of the text
textEffectsThe type of text effect (Outline, Shadow, OutlineAndShadow, None)
static void AC.AdvGame.DuplicateActionsBuffer ( )
static

Duplicates the Actions within the copy buffer, so that they do not reference their original source (Unity Editor only).

static void AC.AdvGame.FindObjectWithConstantID ( int  _constantID)
static

Locates an object with a supplied ConstantID number (Unity Editor only). If the object is not found in the current scene, all scenes in the Build Settings will be searched. Once an object is found, it will be pinged in the Hierarchy window.

Parameters
_constantIDThe ConstantID number of the object to find
static int AC.AdvGame.GetAnimLayerInt ( AnimLayer  animLayer)
static

Returns the integer value of the AnimLayer enum. Necessary because two Neck layers are used, though only one is present in the enum.

Parameters
animLayerThe AnimLayer enum
Returns
The integer value
static Vector2 AC.AdvGame.GetMainGameViewSize ( bool  accountForForcedAspectRatio = false)
static

Returns the screen dimensions as a vector.

Parameters
accountForForcedAspectRatioIf True, the forced aspect ratio defined in the Settings Manager will be accounted for.
Returns
The screen dimensions
static string AC.AdvGame.GetName ( string  resourceName)
static

Gets the name of an asset file, given its path.

Parameters
resourceNameThe full path of the asset file
Returns
The name of the asset
static References AC.AdvGame.GetReferences ( )
static

Returns the References asset, which should be located in a Resources directory.

static string [] AC.AdvGame.GetSceneFiles ( )
static

Returns all scene filenames listed in the Build Settings (Unity Editor only).

Returns
An array of scene filenames as strings
static Vector3 AC.AdvGame.GetScreenNavMesh ( Vector3  targetWorldPosition)
static

Returns the percieved point on a NavMesh of a world-space position, when viewed through screen-space.

Parameters
targetWorldPositionThe position in world-space
Returns
The point on the NavMesh that the position lies when viewed through screen-space
static int AC.AdvGame.GlobalVariableGUI ( string  label,
int  variableID 
)
static

Generates a Global Variable selector GUI (Unity Editor only).

Parameters
labelThe label of the popup GUI
variableIDThe currently-selected global variable's ID number
Returns
The newly-selected global variable's ID number
static Rect AC.AdvGame.GUIBox ( float  centre_x,
float  centre_y,
float  size 
)
static

Generates a Rect from a square.

Parameters
centre_xThe centre of the square in the x-direction
centre_yThe centre of the square in the y-direction
sizeThe size of the square
Returns
The generated Rect
static Rect AC.AdvGame.GUIBox ( Vector2  posVector,
float  size 
)
static

Generates a Rect from a square.

Parameters
posVectorThe top-left corner of the square
sizeThe size of the square
Returns
The generated Rect
static Rect AC.AdvGame.GUIRect ( float  centre_x,
float  centre_y,
float  width,
float  height 
)
static

Generates a Rect from a rectangle.

Parameters
centre_xThe centre of the rectangle in the x-direction
centre_yThe centre of the rectangle in the y-direction
widthThe width of the rectangle
heightThe height of the rectangle
Returns
The generated Rect
static float AC.AdvGame.Interpolate ( float  startT,
float  deltaT,
MoveMethod  moveMethod,
AnimationCurve  timeCurve = null 
)
static

Interpolates a float over time, according to various interpolation methods.

Parameters
startTThe starting time
deltaTThe time difference
moveMethodThe method of interpolation (Linear, Smooth, Curved, EaseIn, EaseOut, Curved)
timeCurveThe AnimationCurve to interpolate against, if the moveMethod = MoveMethod.Curved
Returns
The interpolated float
static float AC.AdvGame.Lerp ( float  from,
float  to,
float  t 
)
static

Lerps from one float to another over time.

Parameters
fromThe initial value
toThe final value
tThe time value. If greater than 1, the result will overshoot the final value
Returns
The lerped float
static Vector3 AC.AdvGame.Lerp ( Vector3  from,
Vector3  to,
float  t 
)
static

Lerps from one Vector3 to another over time.

Parameters
fromThe initial value
toThe final value
tThe time value. If greater than 1, the result will overshoot the final value
Returns
The lerped Vector3
static Quaternion AC.AdvGame.Lerp ( Quaternion  from,
Quaternion  to,
float  t 
)
static

Lerps from one Quaternion to another over time.

Parameters
fromThe initial value
toThe final value
tThe time value. If greater than 1, the result will overshoot the final value
Returns
The lerped Quaternion
static void AC.AdvGame.PlayAnimClip ( Animation  _animation,
int  layer,
AnimationClip  clip,
AnimationBlendMode  blendMode = AnimationBlendMode.Blend,
WrapMode  wrapMode = WrapMode.ClampForever,
float  fadeTime = 0f,
Transform  mixingBone = null,
bool  reverse = false 
)
static

Initialises and plays a legacy AnimationClip on an Animation component.

Parameters
_animationThe Animation component
layerThe layer to play the animation on
clipThe AnimatonClip to play
blendModeThe animation's AnimationBlendMode
wrapModeThe animation's WrapMode
fadeTimeThe transition time to the new animation
mixingBoneThe transform to set as the animation's mixing transform
reverseTrue if the animation should be reversed
static void AC.AdvGame.PlayAnimClipFrame ( Animation  _animation,
int  layer,
AnimationClip  clip,
AnimationBlendMode  blendMode,
WrapMode  wrapMode,
float  fadeTime,
Transform  mixingBone,
float  normalisedFrame 
)
static

Initialises and plays a legacy AnimationClip on an Animation component, starting from a set point.

Parameters
_animationThe Animation component
layerThe layer to play the animation on
clipThe AnimatonClip to play
blendModeThe animation's AnimationBlendMode
wrapModeThe animation's WrapMode
fadeTimeThe transition time to the new animation
mixingBoneThe transform to set as the animation's mixing transform
normalisedFrameHow far along the timeline the animation should start from (0 to 1)
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
int  parameterID = -1,
int  parameterValue = 0 
)
static

Runs an ActionList asset file. If the ActionList contains an Integer parameter, the parameter's value can be set here.

Parameters
actionListAssetThe ActionList asset to run
parameterIDThe ID of the parameter to set
parameterValueThe value to set the parameter to, provided that IsIntegerBased returns True
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
GameObject  parameterValue 
)
static

Runs an ActionList asset file, and sets the value of the first parameter, provided that it is a GameObject.

Parameters
actionListAssetThe ActionList asset to run
parameterValueThe value to set the GameObject parameter to
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
int  parameterID,
GameObject  parameterValue 
)
static

Runs an ActionList asset file, and sets the value of a parameter, provided that it is a GameObject.

Parameters
actionListAssetThe ActionList asset to run
parameterIDThe ID of the parameter to set
parameterValueThe value to set the GameObject parameter to
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
int  i,
bool  addToSkipQueue 
)
static

Runs an ActionList asset file.

Parameters
actionListAssetThe ActionList asset to run
iThe index of the Action to start from
addToSkipQueueTrue if the ActionList should be added to the skip queue
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
Conversation  endConversation 
)
static

Runs an ActionList asset file.

Parameters
actionListAssetThe ActionList asset to run
endConversationThe Conversation to enable when the ActionList is complete
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.RunActionListAsset ( ActionListAsset  actionListAsset,
Conversation  endConversation,
int  i,
bool  doSkip,
bool  addToSkipQueue 
)
static

Runs or skips an ActionList asset file.

Parameters
actionListAssetThe ActionList asset to run
endConversationThe Conversation to enable when the ActionList is complete
iThe index of the Action to start from
doSkipIf True, all Actions within the ActionList will be run and completed instantly.
addToSkipQueueTrue if the ActionList should be added to the skip queue
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static void AC.AdvGame.SetMixerVolume ( AudioMixerGroup  audioMixerGroup,
string  parameter,
float  volume 
)
static

Sets the volume of an Audio Mixer Group (Unity 5 only).

Parameters
audioMixerGroupThe Audio Mixer Group to affect
parameterThe name of the attenuation parameter
volumeThe new volume (ranges from 0 to 1)
static Matrix4x4 AC.AdvGame.SetVanishingPoint ( Camera  _camera,
Vector2  perspectiveOffset 
)
static

Sets the vanishing point of a perspective-locked camera.

Parameters
_cameraThe Camera to affect
perspectiveOffsetThe offset from the perspective's centre
Returns
A Matrix4x4 of the corrected perspective
static RuntimeActionList AC.AdvGame.SkipActionListAsset ( ActionListAsset  actionListAsset)
static

Skips an ActionList asset file.

Parameters
actionListAssetThe ActionList asset to skip
Returns
the temporary RuntimeActionList object in the scene that performs the Actions within the asset
static RuntimeActionList AC.AdvGame.SkipActionListAsset ( ActionListAsset  actionListAsset,
int  i 
)
static

Skips an ActionList asset file.

Parameters
actionListAssetThe ActionList asset to skip
iThe index of the Action to skip from
Returns
The temporary RuntimeActionList object in the scene that performs the Actions within the asset
static string AC.AdvGame.UniqueName ( string  name)
static

Generates a unique name for a GameObject by adding numbers to the end of it.

Parameters
nameThe original name of the GameObject
Returns
A unique name for the GameObject</retuns>

Member Data Documentation

List<AC.Action> AC.AdvGame.copiedActions = new List<AC.Action>()
static

A List of Action classes currently stored in the copy buffer.