I've successfully created a class with um, well, here:
And I obviously start this with a normal 'TechClass tech = new TechClass();' (with the appropriate using).Code:using System;
namespace SP2ClassLibrary
{
public class TechClass
{
/// <summary>
/// Agricultural Tech
/// </summary>
public int[] AT = new int[12]; // 0
/// <summary>
/// Birth Labs Tech
/// </summary>
public int[] BL = new int[12]; // 1
/// <summary>
/// Build Points Tech
/// </summary>
public int[] BP = new int[12]; // 2
... There is a lot more like this too...
}
}
I will obviously change it to a get/set system if you seriously recommend doing so.
First off, what is the best way to convert the property from tech.AT[x] to tech[x].AT? Make it TechClass[] tech = new TechClass[12];? I do suspect that would be the way. BTW, x is the player number, and the letters represent the specific technology level of the player, AT is agricultural tech, so tech.AT[0] is the Agricultural Tech Level of player zero.
After switching this around, I would like to understand how to add um, submethods (sorry, names ALWAYS escape me!). For example, my program does a lot of calculations using these variables, especially text output to a form. One such case is properly formatting this on a form. It would be a lot more readable to have something such as tech[0].AT.Name (as a string type), or tech[0].AT.SpacedString that outputs the variable number (ie. 1) as a string with a set of preceding spaces. My aim is to achieve a very high level of readability in my code, and also to learn more about classes. Anyone up to this?