Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameController : MonoBehaviour
{
    public Transform player;
    public Transform column;
    public GameObject platformPrefab;
    public GameObject badPlatformPrefab;

    private int badChance = 25;
    private GameObject platform;
    private float offset = 0.35f;

    private void Start()
    {
        for (int i = -3; i < 5; i++)
        {
            int platformCount = 0;
            if(Random.Range(0, 2) == 1)
            {
                Instantiate(platform, column.transform.position +
                    new Vector3(-offset, i * 2, offset), 
                    Quaternion.Euler(-90, 0, 0), column.transform);
                platformCount++; // a = a + 1; a++; a += 1;
                
            }
        }
    }

    void randomPlatform()
    {
        if(Random.Range(0, 100) < badChance)
        {
            platform = badPlatformPrefab;
        }
        else
        {
            platform = platformPrefab;
        }
    }

}