私はこれを理解しようとしましたが、できなかったので、ここにあります。int
タイプを暗黙的に変換することはできませんBaseStats.Stat
using UnityEngine;
using System.Collections;
public class BaseStats : MonoBehaviour {
public struct baseStats {
public string name;
public int level;
public Stat hp;
public int ap;
public int strength;
public int toughness;
public int agility;
public int intelligence;
public int willPower;
public int luck;
public int attack;
public int hitPercentage;
public int defence;
public int evasionPercentage;
public int abilityAttack;
public int abilityDefence;
public int abilityDefencePercentage;
public int exp;
public baseStats(string Name, int Level, int Hp, int Ap, int Strength, int Toughness, int Agility, int Intelligence, int WillPower, int Luck, int Attack, int HitPercentage, int Defence, int EvasionPercentage, int AbilityAttack, int AbilityDefence, int AbilityDefencePercentage, int Exp) {
name = Name;
level = Level;
hp = Hp;
ap = Ap;
strength = Strength;
toughness = Toughness;
agility = Agility;
intelligence = Intelligence;
willPower = WillPower;
luck = Luck;
attack = Attack;
hitPercentage = HitPercentage;
defence = Defence;
evasionPercentage = EvasionPercentage;
abilityAttack = AbilityAttack;
abilityDefence = AbilityDefence;
abilityDefencePercentage = AbilityDefencePercentage;
exp = Exp;
}
}
public class Stat {
int current;
int max;
}
void Start() {
baseStats mainChar = new baseStats(
"Truth",
99,
9999,
999,
255,
255,
255,
255,
255,
255,
255,
255,
255,
100,
255,
255,
100,
7777777);
print(mainChar.level);
}
}
現在と最大の HP を取得しようとしていますが、これがチュートリアルで教えられている方法です。残念ながら、チュートリアルは unityscript ですが、私は c# でコーディングを行いたいと思っています。