1enumPropertyName2{3 SEX, HP, AT, DF, SP, LV
4};56class Status
7{8 public Status(float sex,float hp,float at,float df,float sp,float lv)9{10 properties.AddRange(new float[]{ sex, hp, at, df, sp, lv });11}1213 public float this[PropertyName index]14{15 get
16{17return properties[(int)index];18}19 set
20{21 properties[(int)index]= value;22}23}2425 private List<float> properties = new List<float>();2627 public float Sex
28{29 get {return this[PropertyName.SEX];}30 set { this[PropertyName.SEX]= value;}31}3233 public float Hp
34{35 get {return this[PropertyName.HP];}36 set { this[PropertyName.HP]= value;}37}3839 public float At
40{41 get {return this[PropertyName.AT];}42 set { this[PropertyName.AT]= value;}43}4445 public float Df
46{47 get {return this[PropertyName.DF];}48 set { this[PropertyName.DF]= value;}49}5051 public float Sp
52{53 get {return this[PropertyName.SP];}54 set { this[PropertyName.SP]= value;}55}5657 public float Lv
58{59 get {return this[PropertyName.LV];}60 set { this[PropertyName.LV]= value;}61}62}6364public staticvoidMain()65{66 Status[,] statuses = new Status[10,10];67 statuses[1,1]= new Status(1,2,3,4,5,6);68 Console.WriteLine(string.Format("[1, 1] の At は {0} です。全部見てみます。", statuses[1,1].At));69foreach(var p in Enum.GetValues(typeof(PropertyName)))70{71 Console.WriteLine(string.Format("[1, 1] の {0} は {1} です。", Enum.GetName(typeof(PropertyName), p), statuses[1,1][(PropertyName)p]));72}73}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。