Random Mechanics in Unity

Posted on: February 1st, 2015 by tdc_user
Random mechanics in Unity can add excitement and mystery to game play. For our first example, imagine you have just launched a game where the object is to drive or hover along highways that are high up in the air, sitting on giant support cylinders. Let’s also suppose that this game is taking place at a time when your city is under attack by some kind of enemy. Your object is to get to the other side of the game “board”. We can add danger, risk, and excitement to this game by causing some of the highways to collapse by destroying their support pillars at the start of the game; but we’d want to do it randomly, so that the player cannot predict from time to time which highways will be destroyed. unity random destroy at start RandomSupportDestroy.js If we attach the above script to any empty game object, it will find and destroy one of the three support cylinders, and thus cause at least one of the bridges to collapse. A simple example, but from there we have many possibilities. For example, what if we initiate this program when the player has come near a particular trigger? Or what if we put a slight delay on the destruction of game objects, or turn on their “gravity”.

Comments are closed.