Beispiel #1
0
        private void Update()
        {
            wall.Parent.transform.Translate(Vector3.back * (Time.deltaTime * speed));
            if (wall.Parent.transform.position.z > m_WallDistance * -1)
            {
                return;
            }

            SetupTemplate();
            wall.SetupWall(figure, m_WallDistance);
        }
Beispiel #2
0
    private void Start()
    {
        templates = new FitInTheHole_Template[m_Templates.Length];
        for (int i = 0; i < m_Templates.Length; i++)
        {
            templates[i] = Instantiate(m_Templates[i]);
            templates[i].gameObject.SetActive(false);
            templates[i].transform.position = m_FigurePoint.position;
        }

        wall  = new FitInTheHole_Wall(5, 5, m_CubePrefab);
        speed = m_BaseSpeed;
        SetupTemplate();
        wall.SetupWall(figure, m_WallDistance);
    }
    // Start is called before the first frame update
    void Start()
    {
        templates = new FitInTheHole_Template[m_Templates.Length];
        for (int i = 0; i < m_Templates.Length; i++)
        {
            templates[i] = Instantiate(m_Templates[i]);
            templates[i].GeneratePositionVariants();
            templates[i].gameObject.SetActive(false);
            templates[i].transform.position = m_FigurePoint.transform.position;
        }

        wall = new FitInTheHole_Wall(5, 5, m_CubePrefab); //строим стену первый и единственный раз
        SetupTemplate();
        wall.SetupWall(figure, m_WallDistance);
        speed = m_BaseSpeed;
    }
    // Update is called once per frame
    void Update()
    {
        //проверяем условия поражения
        if (wall.Parent.position.z + 1f > m_FigurePoint.position.z &&
            wall.Parent.position.z - 1f < m_FigurePoint.position.z)
        {
            figure.CanMove = false;
            if (!figure.isPlayerInCorrectPosition())
            {
                print($"defeat, your score: {figuresPassed}");
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            }
        }
        //если фигура находится посередине стены и все ОКб запретить ей двигаться
        else
        {
            figure.CanMove = true;
        }



        wall.Parent.transform.Translate(Vector3.back * Time.deltaTime * speed);

        if (wall.Parent.transform.position.z > m_WallDistance * -1f)
        {
            return;
        }

        //увеличиваем скорость каждый раз когда появляется новая фигура
        speed += 1f;

        //отключаем подсказки после нескольких завершенных фигур
        figuresPassed++;
        if (figuresPassed >= m_DisableHintsAfterFigure)
        {
            hintsEnabled = false;
        }
        //если достигли конечной позиции - перезапускаем шаблон и перестраиваем стену
        SetupTemplate();
        wall.SetupWall(figure, m_WallDistance);
    }
Beispiel #5
0
    private void Update()
    {
        wall.Parent.transform.Translate(Time.deltaTime * speed * Vector3.back);
        if (wall.Parent.transform.position.z > figure.transform.position.z)
        {
            return;
        }
        //корявое увеличение скорости
        if (speed < 7.5f)
        {
            speed += 0.5f;
        }

        if (!figure.CheckCoincedence())
        {
            print("You lose");
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
        SetupTemplate();
        wall.SetupWall(figure, m_WallDistance);
    }