finished the talking animations

This commit is contained in:
Rizvee committed 2022-02-22 15:21:38 -06:00
1 parent e19a363e42
commit 65e0fe9510
8 files changed
+288 -25

No files matched your search

+23 -9
View File
@@ -5,10 +5,12 @@ using TMPro;
public class Dialogue : MonoBehaviour
{
public Animator animator;
public TMP_Text textbox;
public TMP_Text arrow;
public AudioManager audioManager;
public List<string> pages = new List<string>();
public List<int> emotes = new List<int>();
int curPage = 0;
public bool isOpen = true;
//used to activate/deactivate test object
@@ -20,6 +22,8 @@ public class Dialogue : MonoBehaviour
//in seconds
float pace = 0.05f;
float elapsed = 0f;
//turns off and on sound
public bool isTalking;
// Start is called before the first frame update
void Start()
{
@@ -46,6 +50,10 @@ public class Dialogue : MonoBehaviour
//checks if all of the characters are on the page
if(cCount >= pages[curPage].Length)
{
//stops the animation
if(animator != null && emotes.Count == pages.Count) {
animator.SetInteger("Animation",emotes[curPage] - 1);
}
//prints the "next" arrow when at end of page except last page
if(curPage < pages.Count - 1)
{
@@ -78,6 +86,10 @@ public class Dialogue : MonoBehaviour
}
else
{
//starts the animation
if(animator != null && emotes.Count == pages.Count) {
animator.SetInteger("Animation",emotes[curPage]);
}
//writes chars at specified pace
elapsed += Time.deltaTime;
if(elapsed > pace)
@@ -85,15 +97,17 @@ public class Dialogue : MonoBehaviour
++cCount;
textbox.text = pages[curPage].Substring(0, cCount);
elapsed = 0;
int RNGSound = Random.Range(0, 2);
if (RNGSound == 0) {
audioManager.Play("blip");
Debug.Log("blip");
}
else
{
audioManager.Play("blop");
Debug.Log("blop");
if(isTalking){
int RNGSound = Random.Range(0, 2);
if (RNGSound == 0) {
audioManager.Play("blip");
Debug.Log("blip");
}
else
{
audioManager.Play("blop");
Debug.Log("blop");
}
}
}
//skip ahead
+115 -5
View File
@@ -69,7 +69,7 @@ MonoBehaviour:
m_text: '>'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_sharedMaterial: {fileID: 1974643164809013703, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_sharedMaterial: {fileID: -6507631187338287659, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
@@ -222,7 +222,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -145}
m_SizeDelta: {x: 650, y: 130}
m_SizeDelta: {x: 450, y: 130}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &432280968903316581
CanvasRenderer:
@@ -313,6 +313,113 @@ SpriteRenderer:
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1650953887092304983
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8637085924552831791}
- component: {fileID: 4883996976931216989}
- component: {fileID: 9032403516113401987}
m_Layer: 5
m_Name: Headshot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8637085924552831791
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1650953887092304983}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 30, y: 30, z: 0.41666666}
m_Children: []
m_Father: {fileID: 7059772332581294261}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -286, y: -147}
m_SizeDelta: {x: 3.125, y: 3.125}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!212 &4883996976931216989
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1650953887092304983}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1458967083
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 3.125, y: 3.125}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &9032403516113401987
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1650953887092304983}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &7059772332122756754
GameObject:
m_ObjectHideFlags: 0
@@ -413,6 +520,7 @@ RectTransform:
- {fileID: 3633192429854996722}
- {fileID: 7059772333148747625}
- {fileID: 8800572322419699558}
- {fileID: 8637085924552831791}
m_Father: {fileID: 7059772333487008124}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -36.808, y: 0, z: 0}
@@ -430,7 +538,7 @@ Canvas:
m_GameObject: {fileID: 7059772332581294260}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_RenderMode: 1
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
@@ -494,8 +602,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4098cb6d8f351b44ca98b3bb6311f330, type: 3}
m_Name:
m_EditorClassIdentifier:
animator: {fileID: 9032403516113401987}
textbox: {fileID: 7059772333148747626}
arrow: {fileID: 7395190149993767727}
audioManager: {fileID: 0}
pages: []
isOpen: 0
textTest: {fileID: 7059772332581294260}
@@ -534,7 +644,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -118}
m_AnchoredPosition: {x: 10, y: -118}
m_SizeDelta: {x: 400, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7059772333148747627
@@ -568,7 +678,7 @@ MonoBehaviour:
m_text: a quick brown fox jumps over the lazy dog
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_sharedMaterial: {fileID: 1974643164809013703, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_sharedMaterial: {fileID: -6507631187338287659, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []