game: removing depreciated scripts

This commit is contained in:
ryan 2025-02-15 22:00:37 +08:00
parent abfdfb3078
commit 82f4ed859f
9 changed files with 23 additions and 385 deletions

View file

@ -4809,17 +4809,14 @@ MonoBehaviour:
dayEnded: 0
shiftStarted: 0
currentNPC: {fileID: 0}
frontWalkPoints:
- {fileID: 1521924626}
- {fileID: 2036976913}
leftWalkPoints:
- {fileID: 950032348}
- {fileID: 397894338}
rightWalkPoints:
- {fileID: 2027209539}
- {fileID: 319260660}
leftWalkPointSet: {fileID: 2107051479}
rightWalkPointSet: {fileID: 1008392718}
initialStatementText: {fileID: 0}
playerQuestionOneText: {fileID: 0}
playerQuestionTwoText: {fileID: 0}
playerQuestionThreeText: {fileID: 0}
npcAnswerOneText: {fileID: 0}
npcAnswerTwoText: {fileID: 0}
npcAnswerThreeText: {fileID: 0}
playerResponse: {fileID: 0}
--- !u!114 &520849217
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4892,6 +4889,9 @@ MonoBehaviour:
spawnPoints:
- {fileID: 1126609777}
npcBufferTime: 5
Seats:
- SeatObject: {fileID: 0}
Available: 0
playerFree: 0
currentNpcs: []
despawnPoints: []

View file

@ -1,107 +0,0 @@
/*
* Author: Livinia Poo
* Date: 29/1/25
* Description:
* Managing behaviour of VR buttons at desk
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeskButtons : MonoBehaviour
{
NPCMovement npcMoveScript;
NPCBehaviour npcBehaviourScript;
private Player playerScript;
public GameObject npcObject;
private string correctDirection;
private string directionSent;
void Start()
{
playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
}
void UpdateNPCReferences()
{
GameObject npcObject = GameManager.instance.currentNPC;
if (npcObject != null)
{
npcMoveScript = npcObject.GetComponent<NPCMovement>();
npcBehaviourScript = npcObject.GetComponent<NPCBehaviour>();
}
}
public void DirectToLeft()
{
UpdateNPCReferences();
if (npcMoveScript == null || npcBehaviourScript == null)
{
Debug.LogWarning("NPC references are null");
return;
}
npcMoveScript.WalkToPlayerLeft();
directionSent = "left";
if (npcBehaviourScript.navigationTxt.text == "I want to go left!")
{
correctDirection = "left";
}
else
{
correctDirection = "right";
}
CheckCorrectDirection();
}
public void DirectToRight()
{
UpdateNPCReferences();
if (npcMoveScript == null || npcBehaviourScript == null)
{
Debug.LogWarning("NPC references are null");
return;
}
npcMoveScript.WalkToPlayerRight();
directionSent = "right";
if (npcBehaviourScript.navigationTxt.text == "I want to go right!")
{
correctDirection = "right";
}
else
{
correctDirection = "left";
}
CheckCorrectDirection();
}
void CheckCorrectDirection()
{
if (correctDirection == directionSent)
{
Player.score += 1;
Player.customersServed += 1;
Debug.Log("correct");
Debug.Log(Player.score);
Debug.Log(Player.customersServed);
}
else
{
Player.score -= 1;
Player.customersServed += 1;
Debug.Log("incorrect");
Debug.Log(Player.score);
Debug.Log(Player.customersServed);
}
}
}

View file

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

View file

@ -1,60 +0,0 @@
/*
* Author: Livinia Poo
* Date: 29/1/25
* Description:
* Customer behaviour
*/
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class NPCBehaviour : MonoBehaviour
{
private NPCMovement npcMoveScript;
[SerializeField] private GameObject paperObject;
[SerializeField] private GameObject navigationTxtBubble;
[SerializeField] public TextMeshProUGUI navigationTxt;
public static bool paperProduced;
private string[] possibleSentences =
{
"I want to go left!",
"I want to go right!"
};
void Start()
{
npcMoveScript = GetComponent<NPCMovement>();
paperObject.SetActive(false);
navigationTxtBubble.SetActive(false);
paperProduced = false;
if (navigationTxt != null)
{
navigationTxt.text = GetRandomSentence();
}
}
void Update()
{
if (npcMoveScript.inFrontOfPlayer == true)
{
paperObject.SetActive(true);
navigationTxtBubble.SetActive(true);
paperProduced = true;
}
}
string GetRandomSentence()
{
int n = Random.Range(0, possibleSentences.Length);
return possibleSentences[n];
}
}

View file

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

View file

@ -1,167 +0,0 @@
/*
* Author: Livinia Poo
* Date: 22/1/25
* Description:
* Customer walking handling
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPCMovement : MonoBehaviour
{
/// <summary>
/// References and Variables
/// </summary>
/*public Transform[] frontWalkPoints;
public Transform[] leftWalkPoints;
public Transform[] rightWalkPoints;*/
public float movementSpeed = 10.0f;
public float turnSpeed = 5.0f;
private int currentPtIndex = 0;
/*[SerializeField] private GameObject leftWalkPointSet;
[SerializeField] private GameObject rightWalkPointSet;*/
public bool inFrontOfPlayer = false;
private GameManager gm;
/// <summary>
/// Start the coroutine
/// </summary>
void Start()
{
gm = GameManager.instance;
StartCoroutine(WalkingToPlayer());
}
///<summary>
///
/// </summary>
public void WalkToPlayerLeft()
{
gm.leftWalkPointSet.SetActive(true);
StartCoroutine(WalkingToPlayerLeft());
}
public void WalkToPlayerRight()
{
gm.rightWalkPointSet.SetActive(true);
StartCoroutine(WalkingToPlayerRight());
}
/// <summary>
/// Coroutine for NPC to walk to each point
/// </summary>
/// <returns></returns>
IEnumerator WalkingToPlayer()
{
while (currentPtIndex < gm.frontWalkPoints.Length)
{
if (gm.frontWalkPoints.Length == 0)
{
yield break;
}
Transform targetPt = gm.frontWalkPoints[currentPtIndex];
Vector3 direction = targetPt.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x,0,direction.z));
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, turnSpeed * Time.deltaTime);
transform.position = Vector3.MoveTowards(transform.position, targetPt.position, movementSpeed * Time.deltaTime);
if (Vector3.Distance(transform.position, targetPt.position) < 0.1f)
{
currentPtIndex++;
if (currentPtIndex >= gm.frontWalkPoints.Length)
{
StopAllCoroutines();
currentPtIndex = 0;
inFrontOfPlayer = true;
yield break;
}
}
yield return null;
}
}
/// <summary>
/// Coroutine for NPC to walk to each point
/// </summary>
/// <returns></returns>
IEnumerator WalkingToPlayerLeft()
{
while (currentPtIndex < gm.leftWalkPoints.Length)
{
if (gm.leftWalkPoints.Length == 0)
{
yield break;
}
Transform targetPt = gm.leftWalkPoints[currentPtIndex];
Vector3 direction = targetPt.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x,0,direction.z));
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, turnSpeed * Time.deltaTime);
transform.position = Vector3.MoveTowards(transform.position, targetPt.position, movementSpeed * Time.deltaTime);
if (Vector3.Distance(transform.position, targetPt.position) < 0.1f)
{
currentPtIndex++;
if (currentPtIndex >= gm.leftWalkPoints.Length)
{
StopAllCoroutines();
currentPtIndex = 0;
yield break;
}
}
yield return null;
}
}
/// <summary>
/// Coroutine for NPC to walk to each point
/// </summary>
/// <returns></returns>
IEnumerator WalkingToPlayerRight()
{
while (currentPtIndex < gm.rightWalkPoints.Length)
{
if (gm.rightWalkPoints.Length == 0)
{
yield break;
}
Transform targetPt = gm.rightWalkPoints[currentPtIndex];
Vector3 direction = targetPt.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x,0,direction.z));
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, turnSpeed * Time.deltaTime);
transform.position = Vector3.MoveTowards(transform.position, targetPt.position, movementSpeed * Time.deltaTime);
if (Vector3.Distance(transform.position, targetPt.position) < 0.1f)
{
currentPtIndex++;
if (currentPtIndex >= gm.rightWalkPoints.Length)
{
StopAllCoroutines();
currentPtIndex = 0;
yield break;
}
}
yield return null;
}
}
}

View file

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

View file

@ -72,11 +72,11 @@ public class NpcMovementRework : MonoBehaviour
public IEnumerator SitDown()
{
var i = Random.Range(0, NpcManager.instance.Seats.Count);
var i = Random.Range(0, NpcManager.instance.Seats.Length);
var seat = NpcManager.instance.Seats[i];
while (!seat.Available)
{
i = Random.Range(0, NpcManager.instance.Seats.Count);
i = Random.Range(0, NpcManager.instance.Seats.Length);
seat = NpcManager.instance.Seats[i];
}

View file

@ -48,7 +48,9 @@ public class NpcManager : MonoBehaviour
/// float for time between npc spawns
/// </summary>
[SerializeField] private float npcBufferTime;
public Seat[] Seats;
/// <summary>
/// a bool to check if the player is free
/// </summary>
@ -58,10 +60,7 @@ public class NpcManager : MonoBehaviour
/// collection of all exiting npcs
/// </summary>
public List<GameObject> currentNpcs;
/// <summary>
/// a collection of positions for the chairs to sit for the npcs
/// </summary>
public GameObject[] chairPositions;
/// <summary>
/// a collection of positions for the npcs to despawn
/// </summary>
@ -136,4 +135,10 @@ public class NpcManager : MonoBehaviour
}
isSpawning = false;
}
[Serializable]
public struct Seat
{
public GameObject SeatObject;
public bool Available;
}
}