Construct class with properties depending on parameter

Ok so basically I am trying to setup an MMORPG. I am new to C Sharp and Unity however I am very experienced in lua. Anyways I started with making classes. My problem is with my vocation class. When I create the object, I want to pass an integer value to my vocation class constructor, and depending on that value the constructor assign default values to the object.

lets take a look at the code I started with before I realized I didn’t know what I was doing.

using UnityEngine;
using System.Collections;
 
public class Vocation : MonoBehaviour
{
	public string Name;
	public uint BaseSpeed;
	public uint ManaGain;
	public uint HealthGain;
	public uint ManaRegen;
	public uint HealthRegen;

	public enum Type
	{
	}

	public Vocation(int voc)
	{

	}

	public class Mage : Vocation
	{
		public Mage()
		{
			Name = "Mage";
			BaseSpeed = 200;
			HealthGain = 10;
			ManaGain = 10;
			HealthRegen = 5;
			ManaRegen = 5;
		}
	}

}

Can someone help me figure out a way to organize and add as many different types of vocations as I want, all with their own default values for the properties such as “HealthGain”, ect, and make it so when I create the vocation like so “Vocation mage = new Vocation(1)”. Please and thank you for any help.

1 Answer

1

Was this the wrong place to ask?