Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GameManager : MonoBehaviour {
- BackgroundGenerator backgroundGenerator;
- void Start () {
- backgroundGenerator = GetComponent<BackgroundGenerator>();
- backgroundGenerator.GenerateBackground(new Vector2(transform.position.x, transform.position.y), new Quaternion(0, 0, 0, 0));
- }
- void Update () {
- }
- }
- public class BackgroundGenerator : MonoBehaviour {
- public GameObject sky01;
- public GameObject mountains01;
- public float forest01Speed = 50;
- public float mountains01Speed = 1;
- Forest forest;
- void Start () {
- forest = GetComponent<Forest>();
- }
- void Update () {
- }
- public void GenerateBackground(Vector3 position, Quaternion rotation)
- {
- Instantiate(forest01, position, rotation);
- Instantiate(mountains01, position, rotation);
- Instantiate(sky01, position, rotation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment