예제 #1
0
    public void Start()
    {
        if (gameOverPanel != null)
        {
            gameOverPanel.SetActive(false);
        }

        _zones = GameObject.FindGameObjectsWithTag(
            "ScoreZone"
            ).ToList <GameObject>(
            ).ConvertAll <SafeZone>(
            (go) => go.GetComponent <SafeZone>()
            );

        _buildingMask = 1 << LayerMask.NameToLayer("Building");

        _bart          = GameObject.Find("Bart");
        _bartZone      = _bart.GetComponent <Enemy>().zone;
        _marge         = GameObject.Find("Marge");
        _margeZone     = _marge.GetComponent <Enemy>().zone;
        _moe           = GameObject.Find("Moe");
        _moeZone       = _moe.GetComponent <Enemy>().zone;
        _moeMovement   = _moe.GetComponent <Movement>();
        _burns         = GameObject.Find("Burns");
        _burnsZone     = _burns.GetComponent <Enemy>().zone;
        _burnsMovement = _burns.GetComponent <Movement>();

        _homerFactory = GameObject.Find("HomerFactory").GetComponent <HomerFactory>();

        const int  populationCount = 8;
        List <int> layers          = new List <int>();

        layers.Add(8);         // Input layer
        layers.Add(18);        // Hidden layer
        layers.Add(2);         // Output layer
        const double mutateChance                   = .4;
        const double mutateMaxFactor                = .4;
        const double migrationPercentage            = 0;
        const double childrenPercentage             = .19;
        const int    generations                    = 1000;
        Action <ANNTrainer, Action <double> > train = (ANNTrainer t, Action <double> callback) => {
            _nn       = t;
            _callback = callback;
            _startGame();
        };

        new EO(
            //populationCount,
            //layers,
            @"C:\Users\Public\EO\mc40mmf40mp0cp19g1000p8generation8.txt",
            mutateChance,
            mutateMaxFactor,
            migrationPercentage,
            childrenPercentage,
            generations,
            train
            );
    }
예제 #2
0
    public void Start()
    {
        if (gameOverPanel != null) {

            gameOverPanel.SetActive(false);
        }

        _zones = GameObject.FindGameObjectsWithTag(
            "ScoreZone"
        ).ToList<GameObject>(
        ).ConvertAll<SafeZone>(
            (go) => go.GetComponent<SafeZone>()
        );

        _buildingMask = 1 << LayerMask.NameToLayer("Building");

        _bart = GameObject.Find("Bart");
        _bartZone = _bart.GetComponent<Enemy>().zone;
        _marge = GameObject.Find("Marge");
        _margeZone = _marge.GetComponent<Enemy>().zone;
        _moe = GameObject.Find("Moe");
        _moeZone = _moe.GetComponent<Enemy>().zone;
        _moeMovement = _moe.GetComponent<Movement>();
        _burns = GameObject.Find("Burns");
        _burnsZone = _burns.GetComponent<Enemy>().zone;
        _burnsMovement = _burns.GetComponent<Movement>();

        _homerFactory = GameObject.Find("HomerFactory").GetComponent<HomerFactory>();

        const int populationCount = 8;
        List<int> layers = new List<int>();
        layers.Add(8); // Input layer
        layers.Add(18); // Hidden layer
        layers.Add(2); // Output layer
        const double mutateChance = .4;
        const double mutateMaxFactor = .4;
        const double migrationPercentage = 0;
        const double childrenPercentage = .19;
        const int generations = 1000;
        Action<ANNTrainer, Action<double>> train = (ANNTrainer t, Action<double> callback) => {

            _nn = t;
            _callback = callback;
            _startGame();
        };

        new EO(
            //populationCount,
            //layers,
            @"C:\Users\Public\EO\mc40mmf40mp0cp19g1000p8generation8.txt",
            mutateChance,
            mutateMaxFactor,
            migrationPercentage,
            childrenPercentage,
            generations,
            train
        );
    }
예제 #3
0
    void Start()
    {
        _factory = GameObject.Find("HomerFactory").GetComponent <HomerFactory>();

        Vector3 p = transform.position;
        Vector3 s = transform.localScale;

        _left  = p.x - s.x / 2;
        _right = p.x + s.x / 2;
        _back  = p.z - s.z / 2;
        _front = p.z + s.z / 2;
    }
예제 #4
0
    void Start()
    {
        _factory = GameObject.Find("HomerFactory").GetComponent<HomerFactory>();

        Vector3 p = transform.position;
        Vector3 s = transform.localScale;

        _left = p.x - s.x / 2;
        _right = p.x + s.x / 2;
        _back = p.z - s.z / 2;
        _front = p.z + s.z / 2;
    }
예제 #5
0
 protected void Awake()
 {
     _factory = GameObject.Find("HomerFactory").GetComponent <HomerFactory>();
 }