Пример #1
0
    private void Update()
    {
        if (CheckDeath())
        {
            if (isAI)
            {
                agent.SetFitness(currentScore + (int)Mathf.Ceil(currenAliveTime));
                agent.TrainingOver();
                StopAllCoroutines();
            }
            else
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            }
        }

        if (!isAI && Input.GetKeyDown(KeyCode.UpArrow))
        {
            Flap();
        }
    }
Пример #2
0
    private void PlacePieces()
    {
        Vector3Int[] points      = new Vector3Int[4];
        Vector2Int[] oriantation = currentPiece.GetOriantation();

        for (int i = 0; i < points.Length; i++)
        {
            points[i] = new Vector3Int(oriantation[i].x, oriantation[i].y, 1);
        }

        if (!gameBoard.SetPoints(points, currentPieces))
        {
            agent.SetFitness(pieces + (int)currentScore / 100);
            agent.TrainingOver();
            Debug.Log("Game Over");
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }

        pieces++;
        agent.SetFitness(pieces + (int)currentScore);
    }