Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class LevelGenerator : MonoBehaviour {
- public GameObject groundPrefab;
- public Transform ThePlayer;
- private int _playerIncrement, _groundIncrement, _deleteIncrement;
- private int _steps, _deleteSteps;
- // Use this for initialization
- void Start ()
- {
- _playerIncrement = 8;
- _groundIncrement = 10;
- _steps = 0;
- }
- // Update is called once per frame
- void Update ()
- {
- DoStep ();
- }
- public void DoStep()
- {
- if (ThePlayer.transform.position.x > _playerIncrement)
- {
- GameObject platform = (GameObject)Instantiate(groundPrefab, new Vector2(_groundIncrement * _steps, 0), Quaternion.identity);
- _playerIncrement += 8;
- _steps++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement