I know that may sound odd, so let me elaborate.
I am creating a custom character controller, but with 2 separate versions, a basic type & an advanced type, advanced inheriting from the basic.
They both have a classes inside them, AirClass & AirClassExt respectively: AirClass has the basics of handling aerial properties while AirClassExt gives more options, as is the point of having these two versions of the controller.
For the sake of not having multiple instances of these air properties in the inspector & the code, I would like to do as follows, with just one instance of either class, depending on which monobehavior is attached:
using UnityEngine;
using System.Collections;
public class ControllerBasic : MonoBehaviour
{
public class AirClass
{
}
protected AirClass _air = new AirClass ();
}
public class ControllerAdvanced : ControllerBasic
{
public class AirClassExt : AirClass
{
}
//Convert (cast) the original class (_air) to the extended class
}
Maybe this isn't the best way to do it but this is what I want to achieve.
Any help would be appreciated.
[EDIT]
This picture shows why I want to do it this way, as having several instances of similar classes will show doubles in the inspector & make for confusing code:
![alt text][1]
-Thank you.
[1]: /storage/temp/96924-air.png
↧