Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class WallGenerator : MonoBehaviour {
- public GameObject Canvas;
- public GameObject WallTop;
- public GameObject WallBot;
- public float position;
- public float between_wall;
- public float StartPostion;
- float Number_of_walls;
- // Мяу
- void Start () {
- Create (8);
- }
- public void Create (float Number_of_walls)
- {
- for (float i = 0; i < Number_of_walls; i++) {
- position = Random.Range (0, 5);
- GameObject Wall1;
- GameObject Wall2;
- Wall1 = Instantiate (WallTop, new Vector3 ((StartPostion - i * between_wall),WallTop.transform.position.y,0), Quaternion.identity);
- Wall1.GetComponent<RectTransform> ().sizeDelta = new Vector2 (100,100 + position * 32);
- Wall1.transform.SetParent(Canvas.transform);
- Wall1.SetActive (true);
- Debug.Log ("Wall 1 Создано: " + position );
- Wall2 = Instantiate (WallBot, new Vector3 ((StartPostion - i * between_wall),WallBot.transform.position.y,0), Quaternion.identity);
- Wall2.GetComponent<RectTransform> ().sizeDelta = new Vector2 (100,100 + ((4 - position)* 32));
- Wall2.transform.SetParent(Canvas.transform);
- Wall2.SetActive (true);
- Debug.Log ("Wall 2 Создано: " + position );
- }
- }
- }
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Move : MonoBehaviour {
- public float MS;
- public int Side;
- //Для указания стороны
- //1 = право
- //-1 = лево
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- transform.Translate (new Vector2 (Side, 0) * MS * Time.deltaTime);
- }
- }
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class RIP : MonoBehaviour {
- public float time;
- //Убиваем :с
- void Start () {
- Destroy (this.gameObject, time);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement