private void Start() { jsonScript = FindObjectOfType <ReadInDialogue>(); globalDioTimeline = FindObjectOfType <DioTimeline>(); UIPopUp = FindObjectOfType <UIPopUp>(); marriageMeter = FindObjectOfType <MarriageMeter>(); }
public void ReadInReady() { jsonScript = FindObjectOfType <ReadInDialogue>(); marriageMeter = FindObjectOfType <MarriageMeter>(); spouceNum = Random.Range(1, 4); // Debug.Log(jsonScript.dialogues.Length); Invoke("changeDio", jsonScript.dialogues[globalDio].time); }
// Use this for initialization private void OnEnable() { jsonScript = FindObjectOfType <ReadInDialogue>(); globalDioTimeline = FindObjectOfType <DioTimeline>(); UIPopUp = FindObjectOfType <UIPopUp>(); marriageMeter = FindObjectOfType <MarriageMeter>(); //Spouce Image set code if (globalDioTimeline.spouceNum == 1) { if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75) { dioImage.GetComponent <Image>().sprite = spouce1[0]; } else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50) { dioImage.GetComponent <Image>().sprite = spouce1[1]; } else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25) { dioImage.GetComponent <Image>().sprite = spouce1[2]; } else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0) { dioImage.GetComponent <Image>().sprite = spouce1[3]; } } else if (globalDioTimeline.spouceNum == 2) { if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75) { dioImage.GetComponent <Image>().sprite = spouce2[0]; } else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50) { dioImage.GetComponent <Image>().sprite = spouce2[1]; } else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25) { dioImage.GetComponent <Image>().sprite = spouce2[2]; } else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0) { dioImage.GetComponent <Image>().sprite = spouce2[3]; } } else if (globalDioTimeline.spouceNum == 3) { if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75) { dioImage.GetComponent <Image>().sprite = spouce3[0]; } else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50) { dioImage.GetComponent <Image>().sprite = spouce3[1]; } else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25) { dioImage.GetComponent <Image>().sprite = spouce3[2]; } else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0) { dioImage.GetComponent <Image>().sprite = spouce3[3]; } } if (currentDio != globalDioTimeline.globalDio) { currentDio = globalDioTimeline.globalDio; pointsAdded = false; } currentText = ""; gameObject.GetComponent <Text>().text = currentText; fullText = jsonScript.dialogues[currentDio].text; if (jsonScript.dialogues[currentDio].type == "question") { question = true; } else { question = false; if (pointsAdded == false) { marriageMeter.marriageMeter = marriageMeter.marriageMeter + 5; pointsAdded = true; } } correctResponse = jsonScript.dialogues[currentDio].answer; StartCoroutine(ShowText()); // AudioSource.PlayClipAtPoint(speech, gameObject.transform.position, 2.0f); }