【发布时间】:2013-04-07 05:07:31
【问题描述】:
using UnityEngine;
using System.Collections;
public class PlayerStats : MonoBehaviour {
[System.Serializable]
public class BaseStats {
string name;
int currentLevel;
int targetLevel = currentLevel + 1;
int currentHp;
int maxHp;
int currentAp;
int maxAp;
int strength;
int toughness;
int agility;
int intelligence;
int willPower;
int luck;
int attack;
int hitPercentage;
int defence;
int defPercentage;
int powerAttack;
int powerDefence;
int powerDefPercentage;
int totalExp;
int totalExpNeeded;
int expTilLevel;
int expMod;
int expBase;
int levelBaseStart = [(targetLevel- 2 ) / 10] * 10 + 2;
}
void AddExp(int experience){
// Update is called once per frame
void Update () {
}
}
我认为 [ ] 将数字取为整数,如果不是这样,我该怎么做?我正在制作 exp 变量以在我的方程式中使用来计算达到某个水平所需的总 exp。提前致谢!!!
【问题讨论】:
-
Math.Floor 还是 Math.Ceiling? - msdn.microsoft.com/en-GB/library/e0b5f0xb.aspx
-
根据需要使用 Math.Ceiling(value) 或 Math.Floor(value)。