cjddmut / Unity-2D-Platformer-Controller

A customizable 2D platformer motor that handles mechanics such as double jumps, wall jumps, and corner grabs. Includes a player controlled prefab that can be dropped into any scene for immediate support.
MIT License
873 stars 163 forks source link

Refactoring #35

Closed llafuente closed 9 years ago

llafuente commented 9 years ago

Hi @cjddmut

Refactoring staff, mostly to separate motorState from the motor-logic though calling some functions. Also remove unnecessary code and add more delegates.

Any comments ?

cjddmut commented 9 years ago

Made a bunch of comments in the file change.

llafuente commented 9 years ago

I addressed all (no push to not lose comments yet)

But i have a problem with this

If we're going to store this then it needs to be responsive incase the layers change during run time (if some script sets a new staticEnvLayerMask ect...)

When i setup setters/getters the Editor broke. This line causes the problem... any idea ?

if (!_properties[STATIC_ENV_LAYER_MASK.name].hasMultipleDifferentValues && _properties[STATIC_ENV_LAYER_MASK.name].intValue == 0)

cjddmut commented 9 years ago

There's a couple of ways to accomplish this. You can store the value on Awake and check on FixedUpdate to see if it has changed...or use a setter/getter with a private file that has been tagged with [SerializeField].

llafuente commented 9 years ago

I willl try asap, I'm testing windows10 and I think I mess my old HDD... hard days...

llafuente commented 9 years ago

I try the SerializeField with no luck, the editor fail... don't know how to properly debug this... so i just switch to the other solution, update @FixedUpdate.

Any more comments?

llafuente commented 9 years ago

@cjddmut can you merge this plz.

I have another PR on top of this to add somehting like a plugin to "Grab motors" (boxes ^^)

I will sent it when it's merged and we can discuss if it's acceptable the "pluggin system" I propose.

cjddmut commented 9 years ago

Sorry about that, will get to it this weekend :)

cjddmut commented 9 years ago

Merged