Merge branch 'feature/inject-prompt-artefact-ui' into 'main'

basic world space artefact interaction prompt

Closes #93

See merge request kernel-panic/revival!46
This commit is contained in:
Cinder Foster-Smith 2021-03-15 16:44:54 +00:00
commit f8d3529420
20 changed files with 733 additions and 302 deletions

View File

@ -13,13 +13,15 @@ MonoBehaviour:
m_Name: Dialogue Settings
m_EditorClassIdentifier:
_gamepadInputPrompts:
blink: 4
blink: 1
boost: 5
timeFreeze: 3
interact: 7
_keyboardInputPrompts:
blink: 1
boost: 2
timeFreeze: 0
blink: 2
boost: 0
timeFreeze: 4
interact: 6
_hideAfter: 5
_radioDialogueKey: event:/VO/Radio Dialogue Line
_dialogueClips:

View File

@ -12,7 +12,7 @@ GameObject:
- component: {fileID: 2205831332405259923}
- component: {fileID: 8272008737841710381}
m_Layer: 0
m_Name: Cylinder
m_Name: Graphics
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -30,7 +30,7 @@ Transform:
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: []
m_Father: {fileID: 8781564213167799764}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2205831332405259923
MeshFilter:
@ -81,6 +81,268 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &3281773580780034656
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1483347660088856974}
- component: {fileID: 171843402970377308}
- component: {fileID: 2658148745440365952}
m_Layer: 0
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1483347660088856974
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3281773580780034656}
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: 7585491580055765505}
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.5, y: 0.5}
--- !u!222 &171843402970377308
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3281773580780034656}
m_CullTransparentMesh: 1
--- !u!114 &2658148745440365952
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3281773580780034656}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: '[INTERACT]'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 11400000, guid: f0accbfa8082019458c71ed769d75681, type: 2}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 0.85
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 0
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 1
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3398621272691566433
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7585491580055765505}
- component: {fileID: 9081311225680906815}
- component: {fileID: 2620423025316115099}
- component: {fileID: 7284579036519760679}
- component: {fileID: 8457166438655354348}
- component: {fileID: 5393817111832759879}
m_Layer: 0
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7585491580055765505
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
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: 1483347660088856974}
m_Father: {fileID: 8781564213167799764}
m_RootOrder: 1
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: 1.09}
m_SizeDelta: {x: 5, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &9081311225680906815
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &2620423025316115099
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
--- !u!114 &7284579036519760679
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &8457166438655354348
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f5353ef6941310847ada59b565108370, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &5393817111832759879
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3398621272691566433}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b1c74c0921372b9439e9b80c4a537ccc, type: 3}
m_Name:
m_EditorClassIdentifier:
_text: {fileID: 2658148745440365952}
_settings: {fileID: 11400000, guid: 67880aab3a7f5124999fcef662a147f9, type: 2}
--- !u!1 &8781564213167799763
GameObject:
m_ObjectHideFlags: 0
@ -92,8 +354,8 @@ GameObject:
- component: {fileID: 8781564213167799764}
- component: {fileID: 8781564213167799767}
- component: {fileID: 8781564213167799766}
- component: {fileID: 8781564213167799761}
- component: {fileID: 3201523991801391447}
- component: {fileID: 8215073799250001962}
m_Layer: 0
m_Name: Interactable Artefact
m_TagString: Untagged
@ -112,8 +374,8 @@ Transform:
m_LocalPosition: {x: 0, y: 0.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8781564214893312960}
- {fileID: 2663749718261374877}
- {fileID: 7585491580055765505}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -166,20 +428,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!136 &8781564213167799761
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 0
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!114 &3201523991801391447
MonoBehaviour:
m_ObjectHideFlags: 0
@ -195,113 +443,17 @@ MonoBehaviour:
_data: {fileID: 0}
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
_artefacts: {fileID: 11400000, guid: f523ac0d77530064b8b41c627b13fae0, type: 2}
--- !u!1 &8781564214893312975
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8781564214893312960}
- component: {fileID: 8781564214893312963}
- component: {fileID: 8781564214893312962}
- component: {fileID: 8781564214893312973}
- component: {fileID: 8781564214893312972}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8781564214893312960
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
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: 8781564213167799764}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8781564214893312963
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &8781564214893312962
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &8781564214893312973
_ui: {fileID: 5393817111832759879}
--- !u!135 &8215073799250001962
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_GameObject: {fileID: 8781564213167799763}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 4
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8781564214893312972
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44966bb2b773ce145a9d6c7c9f42aeba, type: 3}
m_Name:
m_EditorClassIdentifier:
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
_artefact: {fileID: 3201523991801391447}

View File

@ -47,7 +47,7 @@ GameObject:
- component: {fileID: 5661344207112327338}
m_Layer: 0
m_Name: Main_Camera
m_TagString: Untagged
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

View File

@ -367,6 +367,14 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 6808448287154422776}
m_Modifications:
- target: {fileID: 5119468870461405386, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
propertyPath: m_fontSize
value: 36
objectReference: {fileID: 0}
- target: {fileID: 5119468870461405386, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
propertyPath: m_fontAsset
value:
objectReference: {fileID: 11400000, guid: 859b47edaf12fe14782789af604151d5, type: 2}
- target: {fileID: 5119468870989674483, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
propertyPath: m_Pivot.x
value: 0.5

View File

@ -67,7 +67,7 @@ MonoBehaviour:
m_Calls: []
m_text: '[SUBTITLE]'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 859b47edaf12fe14782789af604151d5, type: 2}
m_fontAsset: {fileID: 0}
m_sharedMaterial: {fileID: -2556328756776758742, guid: 859b47edaf12fe14782789af604151d5, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
@ -84,7 +84,7 @@ MonoBehaviour:
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 11400000, guid: 5942ceb29a684b547911383b7099a062, type: 2}
m_spriteAsset: {fileID: 11400000, guid: f0accbfa8082019458c71ed769d75681, type: 2}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901

View File

@ -1,17 +1,18 @@
using System;
using System.Collections;
using System.Collections.Generic;
using FMOD.Studio;
using Google.Apis.Http;
using UnityEngine;
using Ktyl.Util;
using TMPro;
using UnityEngine.Events;
using UnityEngine.InputSystem;
public class ArtefactControl : MonoBehaviour
{
private bool _show;
protected bool _canInteract;
private GUIStyle guiS = new GUIStyle();
public Artefact data => _data;
[SerializeField] private Artefact _data;
public int artefactID => _artefactID;
@ -20,49 +21,49 @@ public class ArtefactControl : MonoBehaviour
[SerializeField] private ArtefactSystem _artefacts;
[SerializeField] private ArtefactInteractUI _ui;
private void OnEnable()
{
_artefacts.RegisterArtefact(_data);
SetNearby(false);
}
private void SetNearby(bool playerNearby)
{
_canInteract = playerNearby;
_ui.gameObject.SetActive(playerNearby);
_nearbyArtefactID.Value = playerNearby ? artefactID : -1;
}
protected virtual void Start()
{
_artefactID = data.artefactID;
_show = data.show;
_canInteract = data.canInteract;
EventHandler.current.onArtefactTriggerEnter += NearArtefact;
EventHandler.current.onArtefactTriggerExit += AwayArtefact;
EventHandler.current.onArtefactPickUp += PickUp;
guiS.fontSize = 22;
guiS.normal.textColor = Color.white;
guiS.alignment = TextAnchor.MiddleCenter;
}
private void NearArtefact(int id)
private void OnTriggerEnter(Collider other)
{
if (id == this._artefactID)
if (!other.gameObject.TryGetComponent(out PlayerInput playerInput))
{
_show = true;
this._canInteract = true;
Debug.LogError("collided with not the player ????", this);
return;
}
SetNearby(true);
_ui.Input = playerInput;
}
private void AwayArtefact(int id)
private void OnTriggerExit(Collider other)
{
if (id == this._artefactID)
{
_show = false;
_canInteract = false;
}
SetNearby(false);
}
protected virtual void PickUp(int id)
{
if (id == this._artefactID)
{
if (_canInteract == true)
@ -80,16 +81,6 @@ public class ArtefactControl : MonoBehaviour
EventHandler.current.ArtefactUI();
Destroy(this.gameObject);
}
}
}
void OnGUI()
{
if (_show)
{
GUI.Label(new Rect(Screen.width / 2 - 50, 0, 100, 100), "Press E to pick up",guiS);
}
}
}

View File

@ -22,9 +22,6 @@ public class ArtefactPreview : MonoBehaviour
private bool Active => gameObject.activeSelf && ( _isPressed && !_useVelocity );
public const string PCMR = "PCMR";
public const string GAMEPAD = "Gamepad";
private void OnEnable()
{
ChangeInput( _playerInput );
@ -72,11 +69,11 @@ public class ArtefactPreview : MonoBehaviour
{
switch ( playerInput.currentControlScheme )
{
case PCMR:
case InputSchemes.PCMR:
_useVelocity = false;
break;
case GAMEPAD:
case InputSchemes.GAMEPAD:
_useVelocity = true;
break;

View File

@ -1,27 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ktyl.Util;
public class ArtefactTriggerArea : MonoBehaviour
{
[SerializeField] private SerialInt _nearbyArtefactID;
[SerializeField] private ArtefactControl _artefact;
private int id => _artefact.artefactID;
private void OnTriggerEnter(Collider Player)
{
EventHandler.current.ArtefactTriggerEnter(id);
//PlayerInputHandler.id = _id;
_nearbyArtefactID.Value = id;
}
private void OnTriggerExit(Collider Player)
{
EventHandler.current.ArtefactTriggerExit(id);
//PlayerInputHandler.id = 0;
_nearbyArtefactID.Value = -1;
}
}

View File

@ -13,26 +13,6 @@ public class EventHandler : MonoBehaviour
current = this;
}
public event Action<int> onArtefactTriggerEnter;
public void ArtefactTriggerEnter(int id)
{
if (onArtefactTriggerEnter != null)
{
onArtefactTriggerEnter(id);
}
}
public event Action<int> onArtefactTriggerExit;
public void ArtefactTriggerExit(int id)
{
if (onArtefactTriggerExit != null)
{
onArtefactTriggerExit(id);
}
}
public event Action<int> onArtefactPickUp;
public void ArtefactPickUp(int id)
{

View File

@ -13,6 +13,7 @@ public class DialogueSettings : ScriptableObject
public int blink;
public int boost;
public int timeFreeze;
public int interact;
}
public InputPromptSpriteIndices GamepadInputPrompts => _gamepadInputPrompts;

View File

@ -21,9 +21,6 @@ using UnityEditor;
[CreateAssetMenu(menuName = "KernelPanic/Dialogue/Dialogue System")]
public partial class DialogueSystem : ScriptableObject
{
private const string PCMR = "PCMR";
private const string GAMEPAD = "Gamepad";
[SerializeField] private DialogueSettings _settings;
// https://stackoverflow.com/questions/2282476/actiont-vs-delegate-event
@ -156,7 +153,7 @@ public partial class DialogueSystem : ScriptableObject
private string ProcessTemplates(string text)
{
var spriteIndices = _currentControlScheme == GAMEPAD
var spriteIndices = _currentControlScheme == InputSchemes.GAMEPAD
? _settings.GamepadInputPrompts
: _settings.KeyboardInputPrompts;
@ -170,7 +167,7 @@ public partial class DialogueSystem : ScriptableObject
public void UpdateControlPrompts(PlayerInput playerInput)
{
var controlScheme = playerInput.currentControlScheme;
if (controlScheme != PCMR && controlScheme != GAMEPAD)
if (controlScheme != InputSchemes.PCMR && controlScheme != InputSchemes.GAMEPAD)
{
Debug.LogError($"could not set unknown control scheme {controlScheme}");
return;

View File

@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public struct InputSchemes
{
public const string PCMR = "PCMR";
public const string GAMEPAD = "Gamepad";
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44966bb2b773ce145a9d6c7c9f42aeba
guid: e153d34772fac3b4a83e3112eb54847f
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,41 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
public class ArtefactInteractUI : MonoBehaviour
{
[SerializeField] private TMP_Text _text;
[SerializeField] private DialogueSettings _settings;
private string _gamepadText;
private string _keyboardText;
public PlayerInput Input { get; set; }
void Awake()
{
_gamepadText = _text.text.Replace("[INTERACT]", $"<sprite index={_settings.GamepadInputPrompts.interact}>");
_keyboardText = _text.text.Replace("[INTERACT]", $"<sprite index={_settings.KeyboardInputPrompts.interact}>");
}
private void OnDisable()
{
Input = null;
}
private void LateUpdate()
{
switch (Input.currentControlScheme)
{
case InputSchemes.PCMR:
_text.text = _keyboardText;
break;
case InputSchemes.GAMEPAD:
_text.text = _gamepadText;
break;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b1c74c0921372b9439e9b80c4a537ccc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FaceCamera : MonoBehaviour
{
private Camera _camera;
private void Start()
{
_camera = Camera.main;
if (!_camera)
{
Debug.LogError("no main camera uh oh", this);
}
}
private void LateUpdate()
{
transform.forward = _camera.transform.forward;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5353ef6941310847ada59b565108370
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &-3506835878812899197
--- !u!21 &-5291093428257559744
Material:
serializedVersion: 6
m_ObjectHideFlags: 1
@ -46,10 +46,10 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84a92b25f83d49b9bc132d206b370281, type: 3}
m_Name: input_prompts
m_Name: buttons
m_EditorClassIdentifier:
hashCode: 948431038
material: {fileID: -3506835878812899197}
hashCode: -194847611
material: {fileID: -5291093428257559744}
materialHashCode: 0
m_Version: 1.1.0
m_FaceInfo:
@ -77,129 +77,171 @@ MonoBehaviour:
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 0
m_Scale: 1
m_Name: input_prompts_0
m_HashCode: 2049246321
m_Scale: 2
m_Name: buttons_0
m_HashCode: -1735648118
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 1
m_Scale: 2
m_Name: input_prompts_1
m_HashCode: 2049246320
m_Name: buttons_1
m_HashCode: -1735648117
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 2
m_Scale: 2
m_Name: input_prompts_2
m_HashCode: 2049246323
m_Name: buttons_2
m_HashCode: -1735648120
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 3
m_Scale: 2
m_Name: input_prompts_3
m_HashCode: 2049246322
m_Name: buttons_3
m_HashCode: -1735648119
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 4
m_Scale: 2
m_Name: input_prompts_4
m_HashCode: 2049246325
m_Scale: 1
m_Name: buttons_4
m_HashCode: -1735648114
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 5
m_Scale: 1
m_Name: input_prompts_5
m_HashCode: 2049246324
m_Name: buttons_5
m_HashCode: -1735648113
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 6
m_Scale: 1
m_Name: buttons_6
m_HashCode: -1735648116
- m_ElementType: 2
m_Unicode: 65534
m_GlyphIndex: 7
m_Scale: 1
m_Name: buttons_7
m_HashCode: -1735648115
m_SpriteGlyphTable:
- m_Index: 0
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 92
m_HorizontalAdvance: 128
m_HorizontalBearingY: 64
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 0
m_Y: 128
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_Y: 300
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 7816068872284341956, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: -8191739510646017925, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 1
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 80
m_HorizontalAdvance: 128
m_HorizontalBearingY: 64
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 0
m_Y: 256
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_X: 100
m_Y: 300
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 2864374711127359003, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: 3713549098536957005, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 2
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 80
m_HorizontalAdvance: 128
m_HorizontalBearingY: 64
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 0
m_Y: 384
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_Y: 200
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 268328667761342747, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: -480254276019886394, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 3
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 80
m_HorizontalAdvance: 128
m_HorizontalBearingY: 64
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 128
m_Y: 256
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_X: 100
m_Y: 200
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 5331073594579601401, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: -6460607209241108654, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 4
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 80
m_HorizontalAdvance: 128
m_HorizontalBearingY: 82.85
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 128
m_Y: 384
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_X: 0
m_Y: 100
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 8039778415432188907, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: 2958514102543403041, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 5
m_Metrics:
m_Width: 128
m_Height: 128
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 92
m_HorizontalAdvance: 128
m_HorizontalBearingY: 82.85
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 128
m_Y: 128
m_Width: 128
m_Height: 128
m_Scale: 1.5
m_X: 100
m_Y: 100
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: -1826817245344109917, guid: 0611a1c41577fb94ca74d3bdf8b8a621, type: 3}
sprite: {fileID: 1008705478319212569, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 6
m_Metrics:
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 82.85
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 0
m_Y: 0
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: -3219683103784253410, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
- m_Index: 7
m_Metrics:
m_Width: 100
m_Height: 100
m_HorizontalBearingX: -0
m_HorizontalBearingY: 82.85
m_HorizontalAdvance: 100
m_GlyphRect:
m_X: 100
m_Y: 0
m_Width: 100
m_Height: 100
m_Scale: 1
m_AtlasIndex: 0
sprite: {fileID: 5830344958925785552, guid: 445260a895bbbc74cbde61be5a1fe903, type: 3}
spriteInfoList: []
fallbackSpriteAssets: []

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5942ceb29a684b547911383b7099a062
guid: f0accbfa8082019458c71ed769d75681
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -1,12 +1,36 @@
fileFormatVersion: 2
guid: 445260a895bbbc74cbde61be5a1fe903
TextureImporter:
internalIDToNameTable: []
internalIDToNameTable:
- first:
213: -8191739510646017925
second: buttons_0
- first:
213: 3713549098536957005
second: buttons_1
- first:
213: -480254276019886394
second: buttons_2
- first:
213: -6460607209241108654
second: buttons_3
- first:
213: 2958514102543403041
second: buttons_4
- first:
213: 1008705478319212569
second: buttons_5
- first:
213: -3219683103784253410
second: buttons_6
- first:
213: 5830344958925785552
second: buttons_7
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@ -35,13 +59,13 @@ TextureImporter:
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 0
wrapV: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
@ -50,9 +74,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
@ -125,11 +149,179 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
sprites:
- serializedVersion: 2
name: buttons_0
rect:
serializedVersion: 2
x: 0
y: 300
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: b7079671158115e80800000000000000
internalID: -8191739510646017925
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_1
rect:
serializedVersion: 2
x: 100
y: 300
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: d44744ada3d298330800000000000000
internalID: 3713549098536957005
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_2
rect:
serializedVersion: 2
x: 0
y: 200
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 6c6e8fbc74bc559f0800000000000000
internalID: -480254276019886394
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_3
rect:
serializedVersion: 2
x: 100
y: 200
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 25f1bd319ff4756a0800000000000000
internalID: -6460607209241108654
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_4
rect:
serializedVersion: 2
x: 0
y: 100
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 1284511c6e0ce0920800000000000000
internalID: 2958514102543403041
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_5
rect:
serializedVersion: 2
x: 100
y: 100
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 9180536c944affd00800000000000000
internalID: 1008705478319212569
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_6
rect:
serializedVersion: 2
x: 0
y: 0
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: e18cc9596436153d0800000000000000
internalID: -3219683103784253410
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: buttons_7
rect:
serializedVersion: 2
x: 100
y: 0
width: 100
height: 100
alignment: 1
pivot: {x: 0, y: 1}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: 0d9c2c289db89e050800000000000000
internalID: 5830344958925785552
vertices: []
indices:
edges: []
weights: []
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 6f7abe16f2df179409968759f1e80cbb
internalID: 0
vertices: []
indices: