I have a game where the blocks fall from the sky to the players last position. But I want the blocks only to fall on a grid based system that way you don’t just have a pile f blocks. Here is my current script:
public class gameMechanics : MonoBehaviour {
public float cubeSpawnTime;
private float cubeSpawnTimeNorm;
public Transform player;
public Transform fallingObject;
public float fallingObjectHeight;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(cubeSpawnTimeNorm <= cubeSpawnTime)
{
cubeSpawnTimeNorm++;
}
else
{
Instantiate(fallingObject, new Vector3(player.position.x, fallingObjectHeight, player.position.z), Quaternion.identity);
cubeSpawnTimeNorm = 0;
}
}
}