A problem with our implementation is that it's possible to leave shards hanging in the air by shooting projectiles around the glass pane, since they never registers a hit they will never fall down.
We tried to implement some code to fix this bug by first adding a script onto all shards which holds some information about the shards:
List<GameObject> neighbors
bool anchor
neighbors is a list of pointers to all the shards that is touching this shard. We initialize this list in a "Awake" method for all the shards.
the anchor boolean value tells if the shard is touching the frame in any way, (touching top, down, left or right part of the frame).
Using this information we tried to implement a recursive method that would check if the shard and it's neighbors where supposed to fall or not depending on the currently "placed" shards (shards not moved by projectile). This implementation proved to be a lot harder than we initially thought though and it's possible that we will not be able to make it work in time for the final project version.
Inga kommentarer:
Skicka en kommentar