Questions tagged «json»

5
将实例或类用于游戏资源(木材,铁,金)
因此,我正在制作一个游戏,您可以在该游戏中将船只发送到地点以买卖木材,铁,黄金等资源。 现在我想知道如何在游戏中创建资源。我想出了两种选择 为每个资源创建一个类: public class ResourceBase { private int value; // other base properties } public class Gold : ResourceBase { public Gold { this.value = 40 // or whatever } } 创建资源类的实例 public class Resource { string name; int value; public Resource(string name, int value) { this.name = name; …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.