Exemplo n.º 1
0
        private void SpawnCircle()
        {
            if (currentProperties.freeSpaceCounter < 247)
            {
                SpawnWall();

                GameObject newPlatform = Instantiate(PlatformPicker(),
                                                     Vector3.up * gameObject.transform.position.y,
                                                     Quaternion.identity,
                                                     LvlCreator.instance.transform);
                PlatformProperties newPlatformProp = newPlatform.GetComponent <PlatformProperties>();
                float newPlatformRotation          = currentProperties.angleOfArc / 2 + newPlatformProp.angleOfArc / 2 + currentProperties.currentRotation;
                newPlatform.transform.Rotate(Vector3.up * (newPlatformRotation));
                newPlatformProp.currentRotation  = newPlatform.transform.rotation.eulerAngles.y;
                newPlatformProp.freeSpaceCounter = currentProperties.freeSpaceCounter + newPlatformProp.angleOfArc;
            }
            else
            {
                if (LvlCreator.instance.lvlDifficulty > LvlCreator.instance.rotationTreshold &&
                    Random.Range(0, 101 - LvlCreator.instance.lvlDifficulty) < LvlCreator.instance.chanceOfAdditionalObstacle)
                {
                    gameObject.GetComponent <PlatformRotator>().freeSpace = 360 - currentProperties.freeSpaceCounter;
                    currentProperties.needToRotate = true;
                }
            }
        }
Exemplo n.º 2
0
 void Start()
 {
     currentProperties = gameObject.GetComponent <PlatformProperties>();
     _platforms        = LvlCreator.instance.platforms;
     SpawnCircle();
 }