Teachers open the door but You must enter by yourself.
using UnityEngine;
public class StartBoard : MonoBehaviour
{
void Start()
{
Destroy(gameObject, 5.0f);
}
}
using UnityEngine;
using TMPro;
public class ScoreBoard : MonoBehaviour
{
public int score=0;
void Update()
{
if(transform.parent.position.z<1020){
GetComponent<TextMeshPro>().text=score.ToString();
}else{
var text=
score==12? "Perfect!\n(12/12)":
score>=9? "Great!\n("+score+ "/12)":
score>=5? "Good Job!\n("+score+"/12)":
"Good Effort!\n("+score+"/12)";
GetComponent<TextMeshPro>().text=text.ToString();
}
}
}
using UnityEngine;
public class Arrow : MonoBehaviour
{
public float velocity=10f;
public float magnify=2f;
public bool flying=false;
public Horse horse;
public Transform bow;
public ScoreBoard scoreBoard
・・・
void OnTriggerEnter(Collider other){
var mato=other.gameObject;
if(mato.tag == "Mato"){
GetComponent<AudioSource>().Play();//的壊れる音
Destroy(mato);
scoreBoard.score++;
}
}
}