174
foreach Renderer component
in rendererComponents
{ component.enabled =
false ;
} Disable colliders:
foreach Collider component
in colliderComponents
{ component.enabled =
false ;
} Debug.Log
Trackable +
mTrackableBehaviour.TrackableName + lost
; mLostTracking =
true ;
mSecondsSinceLost = 0; }
Pause all videos except this one private
void PauseOtherVideosVideoPlaybackBehaviour
currentVideo {
VideoPlaybackBehaviour[] videos
= VideoPlaybackBehaviour[]
FindObjectsOfType typeof
VideoPlaybackBehaviour; foreach
VideoPlaybackBehaviour video in
videos {
if video = currentVideo
{ if
video.CurrentState ==
VideoPlayerHelper.MediaState.PLAYING {
video.VideoPlayer.Pause; }
} }
}
endregion PRIVATE_METHODS
}
37. TurnOffBehaviour.cs
using UnityEngine;
summary A utility behaviour to disable rendering of a game object
at run time. summary
public class
TurnOffBehaviour : TurnOffAbstractBehaviour
{ region
UNITY_MONOBEHAVIOUR_METHODS
175
void Awake
{ if
QCARRuntimeUtilities.IsQCAREnabled {
We remove the mesh components at run-time only, but keep them for
visualization when running in the editor: MeshRenderer
targetMeshRenderer =
this .GetComponentMeshRenderer;
DestroytargetMeshRenderer; MeshFilter
targetMesh =
this .GetComponentMeshFilter;
DestroytargetMesh; }
}
endregion UNITY_MONOBEHAVIOUR_METHODS
}
38. TurnOffWordBehaviour.cs
using UnityEngine;
public class
TurnOffWordBehaviour : MonoBehaviour
{ region
UNITY_MONOBEHAVIOUR_METHODS void
Awake {
if QCARRuntimeUtilities.IsQCAREnabled
{ MeshRenderer
targetMeshRenderer =
this .GetComponentMeshRenderer;
DestroytargetMeshRenderer; The child object for visualizing text is removed
at runtime var
text = transform.FindChild Text
; if
text = null
Destroytext.gameObject; }
}
endregion UNITY_MONOBEHAVIOUR_METHODS
}
39. UserDefinedTargetBuildingBehaviour.cs
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
public class
UserDefinedTargetBuildingBehaviour :
UserDefinedTargetBuildingAbstractBehaviour {
}
40. UserInterfaceButtons.cs
using UnityEngine;
using System.Collections;
176
using System.IO;
public class
UserInterfaceButtons : MonoBehaviour
{ public
float scalingSpeed = 0.03f;
public float
rotationSpeed = 70.0f; public
float translationSpeed = 5.0f;
public GameObject Model; bool
repeatScaleUp = false
; bool
repeatScaleDown = false
; bool
repeatRotateLeft = false
; bool
repeatRotateRight = false
; bool
repeatPositionUp = false
; bool
repeatPositionDown = false
; bool
repeatPositionLeft = false
; bool
repeatPositionRight = false
; void
Update {
if repeatScaleUp {
ScaleUpButton ; }
if repeatScaleDown {
ScaleDownButton ; }
if repeatRotateRight {
RotationRightButton; }
if repeatRotateLeft {
RotationLeftButton; }
if repeatPositionUp {
PositionUpButton; }
if repeatPositionDown {
PositionDownButton; }
if repeatPositionLeft {
PositionLeftButton; }
if repeatPositionRight {
PositionRightButton; }
} public
void CloseAppButton
{ Application.Quit ;
177
} public
void RotationRightButton
{ transform.Rotate
0, -rotationSpeed
Time.deltaTime, 0; GameObject.FindWithTag
Model .transform.Rotate
0, -rotationSpeed Time.deltaTime, 0; }
public void
RotationLeftButton {
transform.Rotate 0,
rotationSpeed Time.deltaTime, 0;
GameObject.FindWithTag Model
.transform.Rotate 0, rotationSpeed Time.deltaTime, 0;
} public
void RotationRightButtonRepeat
{ transform.Rotate
0, -rotationSpeed
Time.deltaTime, 0; repeatRotateRight=
true ;
} public
void RotationLeftButtonRepeat
{ transform.Rotate
0, rotationSpeed
Time.deltaTime, 0; repeatRotateLeft=
true ;
} public
void ScaleUpButton
{ transform.localScale
+= new
Vector3scalingSpeed, scalingSpeed, scalingSpeed; GameObject.FindWithTag
Model .transform.localScale +=
new Vector3 scalingSpeed,
scalingSpeed, scalingSpeed; }
public void
ScaleUpButtonRepeat {
repeatScaleUp = true
; Debug.Log
Up ;
} public
void ScaleDownButtonRepeat
{ repeatScaleDown =
true ;
Debug.Log Down
; }
public void
PositionDownButtonRepeat {
repeatPositionDown = true
; }
public void
PositionUpButtonRepeat
178
{ repeatPositionUp =
true ;
} public
void PositionLeftButtonRepeat
{ repeatPositionLeft =
true ;
} public
void PositionRightButtonRepeat
{ repeatPositionRight =
true ;
} public
void ScaleUpButtonOff
{ repeatScaleUp =
false ;
Debug.Log Off
; }
public void
ScaleDownButtonOff {
repeatScaleDown = false
; Debug.Log
Off ;
} public
void RotateLeftButtonOff
{ repeatRotateLeft =
false ;
Debug.Log Off
; }
public void
RotateRightButtonOff {
repeatRotateRight = false
; Debug.Log
Off ;
} public
void PositionRightButtonOff
{ repeatPositionRight =
false ;
Debug.Log Off
; }
public void
PositionLeftButtonOff {
repeatPositionLeft = false
; Debug.Log
Off ;
} public
void PositionUpButtonOff
{ repeatPositionUp =
false ;
Debug.Log Off
; }
public void
PositionDownButtonOff {
repeatPositionDown = false
; Debug.Log
Off ;
} public
void ScaleDownButton
179
{ transform.localScale
+= new
Vector3- scalingSpeed, -scalingSpeed, -scalingSpeed;
GameObject.FindWithTag Model
.transform.localScale += new
Vector3 -scalingSpeed, -scalingSpeed, -scalingSpeed;
} public
void PositionUpButton
{ GameObject.FindWithTag
Model .transform.Translate 0, 0, -translationSpeed
Time.deltaTime; }
public void
PositionDownButton {
GameObject.FindWithTag Model
.transform.Translate 0,
0, translationSpeed
Time.deltaTime; }
public void
PositionRightButton {
GameObject.FindWithTag Model
.transform.Translate -translationSpeed
Time.deltaTime, 0, 0; }
public void
PositionLeftButton {
GameObject.FindWithTag Model
.transform.Translate translationSpeed
Time.deltaTime, 0, 0; backward
} public
void ChangeScene
string a
{ Application.LoadLevel a;
} public
void AnyButton
{ Debug.Log
Any ;
} }
41. VideoPlaybackAppManager.cs