コード例 #1
0
    void Awake()
    {
        gm          = GameObject.Find("NNGameManager").GetComponent <NNGameManager>();
        pipeSpawner = GameObject.Find("PipeSpawner").GetComponent <PipeSpawner>();

        score   = 0;
        fitness = 0;

        nn = new NeuralNetwork();

        scoreText   = GameObject.Find("DummyScore").GetComponent <Text>();
        fitnessText = GameObject.Find("DummyFitness").GetComponent <Text>();
    }
コード例 #2
0
    void Awake()
    {
        Time.timeScale = timeScale;

        DontDestroyOnLoad(this.gameObject);

        if (instance == null)
        {
            instance = this;
            SceneManager.sceneLoaded += OnSceneLoad;
            population = new Population(populationSize, nnBirdPrefab);
            population.Init();
        }
        else
        {
            Destroy(gameObject);
        }
    }