Fix things and add diary ui

This commit is contained in:
Jens Pitkänen 2020-04-21 03:58:28 +03:00
parent 95c544df04
commit 8dccc09728
7 changed files with 229 additions and 109 deletions

View File

@ -1,89 +0,0 @@
fileFormatVersion: 2
guid: 6e654008c0c551d41b2f83f329e79d6f
timeCreated: 1513273811
licenseType: Store
ModelImporter:
serializedVersion: 21
fileIDToRecycleName:
100000: default
100002: //RootNode
400000: default
400002: //RootNode
2300000: default
3300000: default
4300000: default
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 0.35
meshCompression: 0
addColliders: 0
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -852,6 +852,7 @@ GameObject:
- component: {fileID: 462937706053753531} - component: {fileID: 462937706053753531}
- component: {fileID: 8702400494665140028} - component: {fileID: 8702400494665140028}
- component: {fileID: 1070985534702310852} - component: {fileID: 1070985534702310852}
- component: {fileID: 5513444400062872372}
m_Layer: 11 m_Layer: 11
m_Name: Player m_Name: Player
m_TagString: Player m_TagString: Player
@ -1045,7 +1046,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Loraces: [] Loraces: []
ChunkKeepAliveTransformsParent: {fileID: 3141763353809520921} Radius:
Omnidirectional:
--- !u!114 &1070985534702310852 --- !u!114 &1070985534702310852
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1067,6 +1069,19 @@ MonoBehaviour:
Cooldown: 5 Cooldown: 5
AmbientNoiseCooldown: 0 AmbientNoiseCooldown: 0
Roll: 0 Roll: 0
--- !u!114 &5513444400062872372
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6125707630481988399}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: abaf19d90daa02f469221bf25f8e8e91, type: 3}
m_Name:
m_EditorClassIdentifier:
Display: {fileID: 0}
--- !u!1 &6215241420411417389 --- !u!1 &6215241420411417389
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4375010743267057840
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7922417889657216317}
- component: {fileID: 1030658963256423748}
- component: {fileID: 3485543284967005733}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7922417889657216317
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4375010743267057840}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5157989024608226716}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &1030658963256423748
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4375010743267057840}
m_CullTransparentMesh: 0
--- !u!114 &3485543284967005733
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4375010743267057840}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.8301887, g: 0.8301887, b: 0.8301887, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: a0bb3d007c7133149bd1682bd93b776f, type: 3}
m_FontSize: 28
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Playing diary...
--- !u!1 &4841698058774370802
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5157989024608226716}
m_Layer: 5
m_Name: Diary UI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5157989024608226716
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4841698058774370802}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7922417889657216317}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -50}
m_SizeDelta: {x: 400, y: 100}
m_Pivot: {x: 0, y: 1}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 96726d9a9f1dd874a87e9f790b53973b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -21383,6 +21383,7 @@ RectTransform:
- {fileID: 1615087124718553244} - {fileID: 1615087124718553244}
- {fileID: 1156509021} - {fileID: 1156509021}
- {fileID: 1427206712} - {fileID: 1427206712}
- {fileID: 5727207770602245684}
- {fileID: 1344354208} - {fileID: 1344354208}
- {fileID: 429180126} - {fileID: 429180126}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -24243,7 +24244,7 @@ PrefabInstance:
- target: {fileID: 531861614786402147, guid: 0a942b74adc03b248ac74ce8af504ca5, - target: {fileID: 531861614786402147, guid: 0a942b74adc03b248ac74ce8af504ca5,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 5 value: 6
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 531861614786402147, guid: 0a942b74adc03b248ac74ce8af504ca5, - target: {fileID: 531861614786402147, guid: 0a942b74adc03b248ac74ce8af504ca5,
type: 3} type: 3}
@ -24548,7 +24549,7 @@ PrefabInstance:
- target: {fileID: 5400695020334462789, guid: 2cd64e49ad7ad1c4bb4a4264703d7915, - target: {fileID: 5400695020334462789, guid: 2cd64e49ad7ad1c4bb4a4264703d7915,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 4 value: 5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5400695020334462789, guid: 2cd64e49ad7ad1c4bb4a4264703d7915, - target: {fileID: 5400695020334462789, guid: 2cd64e49ad7ad1c4bb4a4264703d7915,
type: 3} type: 3}
@ -24629,6 +24630,73 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4082236b98d7bfb42b8cd2b342f7f31c, type: 3} m_Script: {fileID: 11500000, guid: 4082236b98d7bfb42b8cd2b342f7f31c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1001 &5727207770602245683
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1921606960}
m_Modifications:
- target: {fileID: 3485543284967005733, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 4841698058774370802, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_Name
value: Diary UI
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 96726d9a9f1dd874a87e9f790b53973b, type: 3}
--- !u!224 &5727207770602245684 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5157989024608226716, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
m_PrefabInstance: {fileID: 5727207770602245683}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5727207770602245685 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3485543284967005733, guid: 96726d9a9f1dd874a87e9f790b53973b,
type: 3}
m_PrefabInstance: {fileID: 5727207770602245683}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &6125707629521091122 --- !u!1001 &6125707629521091122
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -24646,6 +24714,11 @@ PrefabInstance:
propertyPath: Options propertyPath: Options
value: value:
objectReference: {fileID: 5400695019531174118} objectReference: {fileID: 5400695019531174118}
- target: {fileID: 5513444400062872372, guid: 558201eae20fa5540a826edb23937665,
type: 3}
propertyPath: Display
value:
objectReference: {fileID: 5727207770602245685}
- target: {fileID: 6125707628839966535, guid: 558201eae20fa5540a826edb23937665, - target: {fileID: 6125707628839966535, guid: 558201eae20fa5540a826edb23937665,
type: 3} type: 3}
propertyPath: debugLayer.lightMeter.showCurves propertyPath: debugLayer.lightMeter.showCurves
@ -24863,7 +24936,7 @@ PrefabInstance:
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259, - target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
type: 3} type: 3}
propertyPath: ShowInEditor propertyPath: ShowInEditor
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259, - target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259,
type: 3} type: 3}

View File

@ -7,7 +7,7 @@ public class CasettePickup : MonoBehaviour {
public AudioClip[] Clips; public AudioClip[] Clips;
public string DisplayPrompt { public string DisplayPrompt {
get { get {
return (PreviousInQueue != null && PreviousInQueue.Playing) ? "Queue casette" : "Play casette"; return "Play casette";
} }
} }
public bool Playing { public bool Playing {
@ -18,8 +18,6 @@ public class CasettePickup : MonoBehaviour {
public bool PickedUp = false; public bool PickedUp = false;
private AudioSource Source; private AudioSource Source;
private CasettePickup PreviousInQueue;
private int WaitingIndex;
private void Awake() { private void Awake() {
Source = GetComponent<AudioSource>(); Source = GetComponent<AudioSource>();
@ -31,14 +29,7 @@ public class CasettePickup : MonoBehaviour {
transform.localScale = Vector3.Lerp(transform.localScale, Vector3.zero, 10f * Time.deltaTime); transform.localScale = Vector3.Lerp(transform.localScale, Vector3.zero, 10f * Time.deltaTime);
} }
if (PreviousInQueue != null) { if (CasetteProgress.AllCasettesPlayed && !Playing) {
if (!PreviousInQueue.Playing) {
PreviousInQueue = null;
Source.PlayOneShot(Clips[WaitingIndex]);
} else if (PreviousInQueue == null && !Source.isPlaying) {
Destroy(gameObject);
}
} else if (CasetteProgress.AllCasettesPlayed && !Playing) {
Destroy(gameObject); Destroy(gameObject);
} }
} }
@ -47,12 +38,11 @@ public class CasettePickup : MonoBehaviour {
PickedUp = true; PickedUp = true;
int Index = CasetteProgress.PlayNext(); int Index = CasetteProgress.PlayNext();
if (Index != -1) { if (Index != -1) {
if (previous == null) { if (previous != null) {
previous.Source.Stop();
}
Source.PlayOneShot(Clips[Index]); Source.PlayOneShot(Clips[Index]);
} else { CasetteProgress.CurrentlyPlaying = Source;
PreviousInQueue = previous;
WaitingIndex = Index;
}
} }
} }
} }

View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class CasetteProgress : MonoBehaviour { public class CasetteProgress : MonoBehaviour {
public static int CasetteIndex; public static int CasetteIndex;
@ -10,12 +11,20 @@ public class CasetteProgress : MonoBehaviour {
return CasetteIndex >= CasetteCount; return CasetteIndex >= CasetteCount;
} }
} }
public static AudioSource CurrentlyPlaying;
public Text Display;
private void Start() { private void Start() {
CasetteIndex = 0; CasetteIndex = 0;
CasetteCount = 0; CasetteCount = 0;
} }
private void Update() {
if (CurrentlyPlaying != null) {
Display.text = CurrentlyPlaying.isPlaying ? "Playing diary..." : "";
}
}
public static int PlayNext() { public static int PlayNext() {
if (!AllCasettesPlayed) { if (!AllCasettesPlayed) {
int Index = CasetteIndex; int Index = CasetteIndex;