Advertisement
complex34

Untitled

May 26th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class LevelGenerator : MonoBehaviour {
  6.  
  7. public GameObject groundPrefab;
  8. public Transform ThePlayer;
  9. private int _playerIncrement, _groundIncrement, _deleteIncrement;
  10. private int _steps, _deleteSteps;
  11.  
  12. // Use this for initialization
  13. void Start ()
  14. {
  15. _playerIncrement = 8;
  16. _groundIncrement = 10;
  17. _steps = 0;
  18. }
  19.  
  20. // Update is called once per frame
  21. void Update ()
  22. {
  23. DoStep ();
  24. }
  25. public void DoStep()
  26. {
  27. if (ThePlayer.transform.position.x > _playerIncrement)
  28. {
  29. GameObject platform = (GameObject)Instantiate(groundPrefab, new Vector2(_groundIncrement * _steps, 0), Quaternion.identity);
  30. _playerIncrement += 8;
  31. _steps++;
  32.  
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement