NickolausDS / Unity-Free-Flight

A Unity Package to add gliding flight to any Unity Object.
GNU General Public License v3.0
60 stars 13 forks source link

Create Mechanic Overrides for flight modes #112

Closed NickolausDS closed 9 years ago

NickolausDS commented 9 years ago

Mechanic Overrides will allow multiple mechanics to execute simultaneously. Current mechanics only allow a single mechanic to execute at one time. For example, if a player is banking right, and they want to flap at the same time, they need to release the turn button before they can flap (The mechanic precedence system actually does this for them, switching control based on which mechanic holds higher priority). They should be able to do both, since flapping and turning aren't mutually exclusive.

Normal precedence will occur if there is no override for a mechanic. For example, if there was no flapping override for diving, the player would need to release the flapping button for diving to take place. (Which is also expected functionality, because flapping and diving are mutually exclusive.

This task restores pervious functionality form v0.4.x, which achieved the same goal by hardcoding it. That won't be possible for more complex mechanic sets.

NickolausDS commented 9 years ago

Changed name from mechanic overrides to mechanic chains.

Mechanic Chains do indeed allow for multiple mechanics to run simultaneously.

Chains are recursive, meaning you can chain Flapping-->Flaring-->Banking-->Cawing (assuming the chain rules are set for each). Chains also follow Precedence, so in the example above, Flapping would have highest precedence and cawing would have lowest. Chains can be broken when a mechanic of higher precedence is added. If Diving were added to the above (with higher precedence and it only chained Cawing), the chain would then be Diving-->Cawing.