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)。 –