- 任务:给游戏得分评级
- 50分以下:Bad,50分~80分:good,80分以上:great
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour
{
public int score;
// 用于存储分数
// Start is called before the first frame update
void Start()
{
score = Random.Range(0, 101);
// 随机生成一个分数,0~100之间,这里要用101,因为上限不会取到
if (score < 50)
{
Debug.Log("Score:" + score + " You are bad!");
}
else if (score < 80)
{
Debug.Log("Score:" + score + " You are good!");
}
else
{
Debug.Log("Score:" + score + " You are great!");
}
}
// Update is called once per frame
void Update()
{
}
}