forked from cgvr/DeltaVR
add models and use them in archery range minigame
This commit is contained in:
@@ -4,6 +4,8 @@ using UnityEngine;
|
||||
|
||||
public class ModelDisplay : MonoBehaviour
|
||||
{
|
||||
public Transform displayPoint;
|
||||
public Transform glassTransform;
|
||||
public Material modelDisplayActiveMaterial;
|
||||
public Transform wire;
|
||||
public Material wireActiveMaterial;
|
||||
@@ -33,13 +35,13 @@ public class ModelDisplay : MonoBehaviour
|
||||
meshRenderer.material = wireActiveMaterial;
|
||||
}
|
||||
|
||||
gameObject.GetComponent<MeshRenderer>().material = modelDisplayActiveMaterial;
|
||||
glassTransform.GetComponent<MeshRenderer>().material = modelDisplayActiveMaterial;
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.ShapeScannerSuccess, gameObject);
|
||||
|
||||
// Destroy previous generated object
|
||||
Destroy(Model);
|
||||
modelObject.transform.parent = transform;
|
||||
modelObject.transform.position = transform.position;
|
||||
modelObject.transform.parent = displayPoint;
|
||||
modelObject.transform.position = displayPoint.position;
|
||||
Model = modelObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ public class ArcheryRangeNPC : NPCController
|
||||
[Header("Archery Range Config")]
|
||||
public QuestMarker questMarker;
|
||||
public MicrophoneStand microphoneStand;
|
||||
public Transform microphoneStandQuestMarkerPoint;
|
||||
public PushableButton imageGenerationButton;
|
||||
public PushableButton modelGenerationButton;
|
||||
public Image imageDisplay;
|
||||
public ModelDisplay modelDisplay;
|
||||
public Transform startTarget;
|
||||
public float modelDisplaySize = 0.75f;
|
||||
public Transform startTargetQuestMarkerPoint;
|
||||
|
||||
private Texture2D GeneratedTexture;
|
||||
private EventInstance printingSound;
|
||||
@@ -53,7 +55,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
await Task.Delay(6500);
|
||||
SpeakVoiceLine(2);
|
||||
questMarker.gameObject.SetActive(true);
|
||||
questMarker.MoveTo(microphoneStand.transform);
|
||||
questMarker.MoveTo(microphoneStandQuestMarkerPoint.transform);
|
||||
await Task.Delay(3000);
|
||||
|
||||
state = 1;
|
||||
@@ -110,13 +112,13 @@ public class ArcheryRangeNPC : NPCController
|
||||
string encodedTexture = Convert.ToBase64String(GeneratedTexture.EncodeToJPG());
|
||||
byte[] encodedModel = await TrellisClient.Instance.GenerateModel(encodedTexture);
|
||||
|
||||
GameObject spawnedObject = await ModelGenerationUtils.Instance.SpawnModel(encodedModel);
|
||||
GameObject spawnedObject = await ModelGenerationUtils.Instance.SpawnModel(encodedModel, modelDisplaySize);
|
||||
modelDisplay.DisplayModel(spawnedObject);
|
||||
|
||||
if (state == 4)
|
||||
{
|
||||
SpeakVoiceLine(5);
|
||||
questMarker.MoveTo(startTarget);
|
||||
questMarker.MoveTo(startTargetQuestMarkerPoint);
|
||||
state = 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ public class PushableButton : MonoBehaviour
|
||||
public bool startDown;
|
||||
public Transform movableParts;
|
||||
public float moveDuration = 0.25f;
|
||||
public float moveAmount = 0.05f;
|
||||
|
||||
public Transform wire;
|
||||
public Material wireActiveMaterial;
|
||||
@@ -23,7 +24,7 @@ public class PushableButton : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
upPositionY = movableParts.localPosition.y;
|
||||
downPositionY = movableParts.localPosition.y - 0.1f;
|
||||
downPositionY = movableParts.localPosition.y - moveAmount;
|
||||
isButtonDown = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ public class QuestMarker : MonoBehaviour
|
||||
|
||||
if (hoverAboveTransform != null)
|
||||
{
|
||||
Debug.Log("pos before floating: " + transform.position);
|
||||
transform.position = hoverAboveTransform.position + new Vector3(0f, heightAboveTarget, 0f);
|
||||
Debug.Log("pos after floating: " + transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user