Difficulties extending UCC

chrisk

Active member
Hi, Justin,

As I mentioned a few times, I'm trying to extend UCC without modifying the original code as long as possible.
But I find it very difficult(impossible) to extend it without modifying the source code.

Currently, the codes are written as a closed system; many members are private and not meant to be extended.

There are a couple of ways to extend them as you know very well; through Partial classes and inheritance.

I need both of them depends on the situation.

My first choice is to create Partial classes if no overriding is needed, but sometimes I need the overrides.

My request is that, please make your classes partial classes at least and make the members variable as protected and virtual for methods.

We can discuss what needs be protected and virtual but at least making all classes as Partial won't hurt.

What do you think?

Thanks.
 
This is for the ItemActions, correct? Overall I prefer the idea of partial classes instead of virtual methods because it has no effect on performance (even if very minimal). I do think that some key ItemAction methods can be virtual though to make inheriting easier, methods such as actually firing the weapons.
 
It's not only for ItemActions but for many future things that don't even know yet. ^^
For example, I need to override UpdateLookVector in PlayerInput to fix the camera when the cursor is visible.

Code:
 protected override void UpdateLookVector()
        {
            if (IsCursorVisible())
            {
                m_CurrentLookVector = Vector2.zero;
                return;
            }

            base.UpdateLookVector();
        }


Sure, Partial won't hurt and I understand about the price we have to pay for virtual functions.

I guess the good assumption to make is that you are always going to extend the classes and figure out what needs be accessed/ overrided.

You probably know it better than anyone. ^^

Thanks.
 
Top