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.
Your answer
![](https://koobas.hobune.stream/wayback/20220612084323im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotation problems 0 Answers
[Absolute beginner] Play animation on trigger (trigger = several fallen objects) script 1 Answer
"Method must have a return type" 1 Answer
plz help me in Trivia Quiz Game Template setup 0 Answers
How to put the server to the player and client see be in the camera? 0 Answers