Add center speech command
This commit is contained in:
parent
333076dc15
commit
a89f01351f
|
@ -60,13 +60,13 @@ MonoBehaviour:
|
|||
axisConstraint: 0
|
||||
- localizationKey:
|
||||
keyword: Rotate
|
||||
keyCode: 273
|
||||
action:
|
||||
id: 0
|
||||
description: None
|
||||
axisConstraint: 0
|
||||
- localizationKey:
|
||||
keyword: Unfollow
|
||||
keyCode: 0
|
||||
action:
|
||||
id: 0
|
||||
description: None
|
||||
axisConstraint: 0
|
||||
- localizationKey:
|
||||
keyword: Center
|
||||
keyCode: 0
|
||||
action:
|
||||
id: 0
|
||||
|
|
|
@ -7681,6 +7681,34 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- keyword: Center
|
||||
response:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1193822414}
|
||||
m_TargetAssemblyTypeName: ConfigureOrbital, Assembly-CSharp
|
||||
m_MethodName: CenterCanvasesToUser
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 2018722013}
|
||||
m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine
|
||||
m_MethodName: PlayOneShot
|
||||
m_Mode: 2
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 8300000, guid: 4075162bd7e8d9b4387ba77aeb751a0d, type: 3}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.AudioClip, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
persistentKeywords: 0
|
||||
speechConfirmationTooltipPrefab: {fileID: 8046114618238072051, guid: 271778f6c957b524981067a81d238394, type: 3}
|
||||
--- !u!82 &2018722013
|
||||
|
|
|
@ -55,4 +55,35 @@ public class ConfigureOrbital : MonoBehaviour
|
|||
canvas.transform.rotation = Quaternion.LookRotation(directionToCamera);
|
||||
}
|
||||
}
|
||||
|
||||
public void CenterCanvasesToUser()
|
||||
{
|
||||
List<GameObject> canvases = endpointLoader.GetInstantiatedItems();
|
||||
|
||||
Vector3 localOffset = new Vector3(-0.4f, 0.1f, 1f);
|
||||
|
||||
foreach (GameObject canvas in canvases)
|
||||
{
|
||||
Transform cameraTransform = Camera.main.transform;
|
||||
|
||||
canvas.transform.position = cameraTransform.position + cameraTransform.TransformDirection(localOffset);
|
||||
// canvas.transform.rotation = Quaternion.LookRotation(canvas.transform.position - cameraTransform.position);
|
||||
// canvas.transform.rotation = Quaternion.LookRotation(-cameraTransform.position);
|
||||
// canvas.transform.rotation = Quaternion.Euler(0, cameraTransform.eulerAngles.y, 0);
|
||||
canvas.transform.rotation = Quaternion.LookRotation(cameraTransform.forward, cameraTransform.up);
|
||||
|
||||
localOffset = new Vector3(localOffset.x + GetItemWidth(canvas), localOffset.y, localOffset.z);
|
||||
}
|
||||
}
|
||||
|
||||
private float GetItemWidth(GameObject item)
|
||||
{
|
||||
RectTransform rectTransform = item.GetComponent<RectTransform>();
|
||||
if (rectTransform != null)
|
||||
{
|
||||
return rectTransform.rect.width * rectTransform.lossyScale.x + 0.2f;
|
||||
}
|
||||
|
||||
return 0.8f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue