game(many): upd playg, interim scripts, interfaces tag

This commit is contained in:
Mark Joshwel 2024-08-11 07:20:11 +08:00
parent 0ac2b01c10
commit fa3eebba97
6 changed files with 222 additions and 52 deletions

View file

@ -185,6 +185,26 @@ PrefabInstance:
propertyPath: m_TagString
value: Player
objectReference: {fileID: 0}
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_BackGroundColor.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_BackGroundColor.b
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_BackGroundColor.g
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_BackGroundColor.r
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8047161636021232021, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_Name
@ -7605,6 +7625,55 @@ MonoBehaviour:
linkedLeapTrigger1: {fileID: 1785766166}
linkedLeapTrigger2: {fileID: 0}
linkedLeapTrigger3: {fileID: 0}
--- !u!1 &618797798
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 618797800}
- component: {fileID: 618797799}
m_Layer: 5
m_Name: Interaction Prompt Overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &618797799
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618797798}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 21896e34ffd76694aa03bd08a51762a9, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 5ecae982f651ff6438bbaa95ba0362e1,
type: 3}
m_SortingOrder: 0
--- !u!4 &618797800
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618797798}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 16.463919, y: -4.84284, z: 19.970129}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1798850120}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!43 &691061213
Mesh:
m_ObjectHideFlags: 0
@ -7770,6 +7839,56 @@ Mesh:
offset: 0
size: 0
path:
--- !u!1 &917153437
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 917153439}
- component: {fileID: 917153438}
m_Layer: 0
m_Name: Audio Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &917153438
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 917153437}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 723a7675db014cb3aca02f49d069e931, type: 3}
m_Name:
m_EditorClassIdentifier:
musicSource: {fileID: 0}
musicSourceDefaultVolume: 0.6
sfxSource: {fileID: 0}
sfxSourceDefaultVolume: 0.6
menuButtonClick: {fileID: 0}
menuButtonHover: {fileID: 0}
--- !u!4 &917153439
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 917153437}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -16.463919, y: 4.84284, z: -19.970129}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1006498776
GameObject:
m_ObjectHideFlags: 0
@ -11029,6 +11148,50 @@ BoxCollider:
serializedVersion: 3
m_Size: {x: 1.5532818, y: 0.5110284, z: 1.2993164}
m_Center: {x: 0.77663994, y: 0.21773233, z: 0.6496582}
--- !u!1 &1766444913
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1766444915}
- component: {fileID: 1766444914}
m_Layer: 0
m_Name: Game Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1766444914
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1766444913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f6e55d96ef14d65979aabb99a0d5f1a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1766444915
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1766444913}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -16.463919, y: 4.84284, z: -19.970129}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1785766159
GameObject:
m_ObjectHideFlags: 0
@ -11396,6 +11559,38 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
isPlayerInAir: 0
--- !u!1 &1798850119
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1798850120}
m_Layer: 0
m_Name: Interfaces
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1798850120
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1798850119}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -16.463919, y: 4.84284, z: -19.970129}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 618797800}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1805235905
GameObject:
m_ObjectHideFlags: 0
@ -12099,6 +12294,9 @@ Mesh:
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1766444915}
- {fileID: 917153439}
- {fileID: 1798850120}
- {fileID: 567431775}
- {fileID: 1656492132}
- {fileID: 1120089}

View file

@ -1,5 +1,5 @@
/*
* authors: ryan lin, mark joshwel
* authors: mark joshwel, ryan lin
* date: 10/8/2024
* description: common interactable behaviour class
*/
@ -7,12 +7,17 @@
using UnityEngine;
/// <summary>
/// TODO
/// base behaviour class for interactable objects
/// </summary>
public class CommonInteractable : MonoBehaviour
{
/// <summary>
/// TODO
/// the prompt to display when the player is looking at the object
/// </summary>
public string interactionPrompt = "";
/// <summary>
/// skeleton function for interacting with the object
/// </summary>
public virtual void Interact()
{

View file

@ -21,11 +21,6 @@ public class CommonMenu : MonoBehaviour
/// </summary>
public GameManager.DisplayState associatedState = GameManager.DisplayState.UnassociatedState;
/// <summary>
/// manager for audio
/// </summary>
protected AudioManager Audio;
/// <summary>
/// manager for the game state
/// </summary>
@ -47,9 +42,6 @@ private void Start()
if (Game == null)
throw new Exception("CommonMenu: Game not set (was base.OnEnable() or PostEnable() called?)");
if (Audio == null)
throw new Exception("CommonMenu: Audio not set (was base.OnEnable() or PostEnable() called?)");
}
/// <summary>
@ -68,10 +60,10 @@ public void PostEnable()
{
// get audio manager singleton instance from the world
UI = GetComponent<UIDocument>().rootVisualElement;
Audio = AudioManager.Instance;
// Audio = AudioManager.Instance;
Game = GameManager.Instance;
// subscribe to hover events
// // subscribe to hover events
UI.RegisterCallback<PointerOverEvent>(HoverListener);
}
@ -104,8 +96,8 @@ public virtual void ClickListener(ClickEvent evt)
/// </summary>
public virtual void PlayClick()
{
// play click sound
Audio.PlayOnSFXChannel(Audio.menuButtonClick);
// TODO: play click sound
// Game.PlayOnSFXChannel(Audio.menuButtonClick);
}
/// <summary>
@ -113,7 +105,7 @@ public virtual void PlayClick()
/// </summary>
public virtual void PlayHover()
{
// play hover sound
Audio.PlayOnSFXChannel(Audio.menuButtonHover);
// TODO: play hover sound
// Game.PlayOnSFXChannel(Audio.menuButtonHover);
}
}

View file

@ -5,7 +5,6 @@
*/
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// singleton class for managing the game state as a single source of truth
@ -18,11 +17,11 @@ public class GameManager : MonoBehaviour
public enum DisplayState
{
Game,
ScreenMainMenu,
ScreenOptionsMenu,
OverlayPauseMenu,
OverlayCompleteUnderTimeMenu,
OverlayFailedOverTimeMenu,
ScreenMainMenu, // done
ScreenOptionsMenu, // done
OverlayPauseMenu, // TODO
OverlayCompleteUnderTimeMenu, // TODO
OverlayFailedOverTimeMenu, // TODO
UnassociatedState
}
@ -39,19 +38,8 @@ public enum DisplayState
/// <summary>
/// property to check if the game is paused based on the current <c>DisplayState</c>
/// </summary>
// TODO: remove this if not needed
public bool Paused => _state != DisplayState.Game;
// /// <summary>
// /// the current scene of the game, used for scene switching and state transitions
// /// </summary>
// private Scene _currentScene;
//
// /// <summary>
// /// the previous scene of the game, used for scene switching and state transitions
// /// </summary>
// private Scene _previousScene;
/// <summary>
/// function to set doesn't destroy on load and checks for multiple instances
/// </summary>
@ -84,13 +72,6 @@ private void Awake()
private void Start()
{
SetDisplayState(DisplayState.ScreenMainMenu);
// _currentScene = SceneManager.GetSceneByName("S2 World");
// _previousScene = _currentScene;
// if (_currentScene == null)
// {
// throw new Exception("GameManager.Start: current scene is null");
// }
}
/// <summary>
@ -99,7 +80,7 @@ private void Start()
private void HideMenuHelper()
{
// get all child menus in the "Menus" parent object
foreach (var menu in GameObject.FindGameObjectsWithTag("Menus"))
foreach (var menu in GameObject.FindGameObjectsWithTag("Interfaces"))
foreach (Transform menuChild in menu.transform)
{
// disable the menu if it's currently active
@ -146,7 +127,7 @@ private void PauseGameHelper(DisplayState incomingState)
HideMenuHelper();
// get all child menus in the "Menus" parent object
foreach (var menuParent in GameObject.FindGameObjectsWithTag("Menus"))
foreach (var menuParent in GameObject.FindGameObjectsWithTag("Interfaces"))
foreach (Transform menu in menuParent.transform)
{
// show the menu based on the incoming state
@ -201,9 +182,6 @@ private void ResumeGameHelper(DisplayState incomingState)
/// <param name="displayState">the game menu to show</param>
public void SetDisplayState(DisplayState displayState)
{
// boolean check if we're transitioning to the same state
var transitioning = _state == displayState;
// check if the game is paused or not
if (displayState is DisplayState.Game or DisplayState.UnassociatedState)
{

View file

@ -76,10 +76,7 @@ private void Update()
// show an interaction prompt if we're looking at an interactable object
var prompt = Hit.collider.GetComponent<CommonInteractable>()?.interactionPrompt;
if (prompt != "")
{
Debug.Log(prompt);
}
if (prompt != "") Debug.Log(prompt);
}
/// <summary>

View file

@ -7,7 +7,7 @@ TagManager:
- CinemachineTarget
- Interactable
- AIs
- Menus
- Interfaces
layers:
- Default
- TransparentFX