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。感谢高级!!!levelBaseStart有什么问题?
Math.Floor或Math.Ceiling? - http://msdn.microsoft.com/en-GB/library/e0b5f0xb.aspx – Sayse
根据需要使用Math.Ceiling(value)或Math.Floor(value)。 –