示例#1
0
    private void FindAgent()
    {
        if (currentAgent == null)
        {
            currentAgent = FindObjectOfType <NEATAgent>();
        }

        //beacuse f**k you (aka read the manual)
        if (currentAgent == null)
        {
            Debug.LogError("NEAT agent was not found, have you tried getting your shit together (aka, add a NEAT agent component on your training object)");
            foreach (var obj in FindObjectsOfType <GameObject>())
            {
                if (obj != gameObject)
                {
                    Destroy(obj);
                }
            }

            Destroy(gameObject);
            return;
        }

        currentAgent.SetEvolver(this);
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     agent      = GetComponent <NEATAgent>();
     rb2d       = GetComponent <Rigidbody2D>();
     spriteRend = GetComponent <SpriteRenderer>();
     orgSprite  = spriteRend.sprite;
     startPos   = transform.position;
     distance   = 0;
 }
示例#3
0
    private void Start()
    {
        rb2d            = GetComponent <Rigidbody2D>();
        agent           = GetComponent <NEATAgent>();
        cameraBounds    = Camera.main.orthographicSize;
        currentScore    = 0;
        currenAliveTime = 0;
        text.text       = "Score: " + currentScore;

        if (isAI)
        {
            StartCoroutine(AIFlap());
            StartCoroutine(Counter());
        }
    }
示例#4
0
文件: GameBoard.cs 项目: Johbja/NEAT
    private void Start()
    {
        agent        = GetComponent <NEATAgent>();
        blockBounds  = blocks[0].GetComponent <SpriteRenderer>().bounds.size;
        blockBorders = blockBounds * new Vector2(width, hight);
        gameBoard    = new BoardMatrix(width, hight, transform.position, blockBounds, blockBorders);

        waitTime        = 0;
        currentMoveTime = waitMoveTime;
        currentScore    = 0;
        comboWhitLast   = false;
        combo           = 1;
        pieces          = 0;

        scoreText.text = "Score: 0";
        comboText.text = "Combo: 1";

        AddAllPiecesTypes();
        ClearPieces();
        CreateNewPiece();
        StartCoroutine(MoveCurrenPiece());
    }
示例#5
0
 void Start()
 {
     rb2d  = GetComponent <Rigidbody2D>();
     agent = GetComponent <NEATAgent>();
     jump  = false;
 }