示例#1
0
    void Update()
    {
        if (GameLogic.gamePaused || GameLogic.gameOver)
        {
            return;
        }

        if (timeLeft <= 0 && exit == null)
        {
            CreateEnemyExit();
        }

        timeLeft -= Time.deltaTime;
        time     += Time.deltaTime;
        if (time >= snakeLogic.speed)
        {
            pathFinder.ClearGrid();
            GetGridObstacles();
            MoveEnemy();
            snakeLogic.RestoreSpeed();
            time = 0;
        }
    }