How to implement the setup rules like Clash of Clan?
- by user25959
Now I'm already implement the setup build rules which the building could move by unit grid width and height. But the validation detection is poor efficiency. The algorithm cost me 10~12(ms) in average when I move the building.
Here is my approach to that:
1.Basic Grid, it is a two dimensional array. Grid[row][column], so that I can save info for each grid. Like whether is it in occupied or excluded.
2.Exclude Space, this is a space which limit same building numbers in space.