using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DamageCalculator : MonoBehaviour
{
public float hit1, hit2, hit3, hit4, hit5;// 可以直接用逗号创建类似的变量// Start is called before the first frame updatevoidStart(){
hit1 = Random.Range(0f,100f);
hit2 = Random.Range(0f,100f);
hit3 = Random.Range(0f,100f);
hit4 = Random.Range(0f,100f);
hit5 = Random.Range(0f,100f);float average =(hit1 + hit2 + hit3 + hit4 + hit5)/5;// 不要忘记括号
average = Mathf.Round(average *100f)/100f;// 保留两位小数// 先乘以 100 然后取整,然后再除以 100
Debug.Log("Average Damage: "+ average);}// Update is called once per framevoidUpdate(){}}