game: checking if correct stamp
This commit is contained in:
parent
5b5e16d4db
commit
ddd3e4be82
5 changed files with 49 additions and 26 deletions
|
@ -23,7 +23,6 @@ public class GameManager : MonoBehaviour
|
|||
public bool shiftStarted;
|
||||
|
||||
public GameObject currentNPC;
|
||||
public GameObject currentStampDoc;
|
||||
|
||||
[Header("Walk Points (FOR DEBUGGING")]
|
||||
public Transform[] frontWalkPoints;
|
||||
|
|
|
@ -25,7 +25,4 @@ public class NpcData
|
|||
public int points;
|
||||
public bool hasPaper;
|
||||
public string correctDepartment;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -12,13 +12,7 @@ using UnityEngine.XR.Interaction.Toolkit;
|
|||
using UnityEngine.XR.Interaction.Toolkit.Interactors;
|
||||
public class PenInteractor : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject stampDoc;
|
||||
private StampDocument stampDocScript;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
stampDocScript = stampDoc.GetComponent<StampDocument>();
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
|
@ -26,7 +20,18 @@ public class PenInteractor : MonoBehaviour
|
|||
{
|
||||
if (collision.collider.gameObject.name == "Stamp-Sign Area")
|
||||
{
|
||||
stampDocScript.SignDocument();
|
||||
stampDocScript = collision.gameObject.GetComponent<StampDocument>();
|
||||
|
||||
if(stampDocScript != null)
|
||||
{
|
||||
if(!stampDocScript.isSigned)
|
||||
{
|
||||
stampDocScript.SignDocument();
|
||||
} }
|
||||
else
|
||||
{
|
||||
Debug.LogError("Paper doesn't have StampDocScript");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@ public class StampDocument : MonoBehaviour
|
|||
[SerializeField] private GameObject disabilitiesStamp;
|
||||
[SerializeField] private GameObject signature;
|
||||
|
||||
public bool isStamped;
|
||||
public bool isSigned;
|
||||
public string assignedService;
|
||||
|
||||
void Start()
|
||||
{
|
||||
financialStamp.SetActive(false);
|
||||
|
@ -17,30 +21,42 @@ public class StampDocument : MonoBehaviour
|
|||
dvStamp.SetActive(false);
|
||||
disabilitiesStamp.SetActive(false);
|
||||
signature.SetActive(false);
|
||||
|
||||
isSigned = false;
|
||||
isStamped = false;
|
||||
}
|
||||
|
||||
public void StampFinancial()
|
||||
{
|
||||
financialStamp.SetActive(true);
|
||||
isStamped = true;
|
||||
assignedService = "Financial";
|
||||
}
|
||||
|
||||
public void StampResidential()
|
||||
{
|
||||
residentialStamp.SetActive(true);
|
||||
isStamped = true;
|
||||
assignedService = "Residential";
|
||||
}
|
||||
|
||||
public void StampDV()
|
||||
{
|
||||
dvStamp.SetActive(true);
|
||||
isStamped = true;
|
||||
assignedService = "Domestic Violence";
|
||||
}
|
||||
|
||||
public void StampDisabilities()
|
||||
{
|
||||
disabilitiesStamp.SetActive(true);
|
||||
isStamped = true;
|
||||
assignedService = "Disabilities";
|
||||
}
|
||||
|
||||
public void SignDocument()
|
||||
{
|
||||
signature.SetActive(true);
|
||||
isSigned = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,11 @@ public class StampInteractor : MonoBehaviour
|
|||
{
|
||||
public string stampName;
|
||||
|
||||
[SerializeField] private GameObject stampDoc;
|
||||
private StampDocument stampDocScript;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
stampName = gameObject.name;
|
||||
|
||||
stampDocScript = stampDoc.GetComponent<StampDocument>();
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
|
@ -23,21 +20,30 @@ public class StampInteractor : MonoBehaviour
|
|||
{
|
||||
if (collision.collider.gameObject.name == "Stamp-Sign Area")
|
||||
{
|
||||
if (stampName == "Stamp_Financial")
|
||||
stampDocScript = collision.gameObject.GetComponent<StampDocument>();
|
||||
|
||||
if(stampDocScript != null)
|
||||
{
|
||||
stampDocScript.StampFinancial();
|
||||
if (stampName == "Stamp_Financial" && !stampDocScript.isStamped)
|
||||
{
|
||||
stampDocScript.StampFinancial();
|
||||
}
|
||||
else if (stampName == "Stamp_Residential" && !stampDocScript.isStamped)
|
||||
{
|
||||
stampDocScript.StampResidential();
|
||||
}
|
||||
else if (stampName == "Stamp_DV" && !stampDocScript.isStamped)
|
||||
{
|
||||
stampDocScript.StampDV();
|
||||
}
|
||||
else if (stampName == "Stamp_Disabilities" && !stampDocScript.isStamped)
|
||||
{
|
||||
stampDocScript.StampDisabilities();
|
||||
}
|
||||
}
|
||||
else if (stampName == "Stamp_Residential")
|
||||
else
|
||||
{
|
||||
stampDocScript.StampResidential();
|
||||
}
|
||||
else if (stampName == "Stamp_DV")
|
||||
{
|
||||
stampDocScript.StampDV();
|
||||
}
|
||||
else if (stampName == "Stamp_Disabilities")
|
||||
{
|
||||
stampDocScript.StampDisabilities();
|
||||
Debug.LogError("Paper doesn't have StampDocScript");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue