private PerceptronInterface PI; //Perceptron interface void Start() { //Find cow control THC = gameObject.GetComponent <TutorialCowControl>(); //Hiden layers and neurons int[] Layers = new int[2]; Layers[0] = 9; Layers[1] = 9; //Create perceptron PCT.CreatePerceptron(1, false, true, 4, Layers, 3); //Add perceptron interface to game object & add perceptron to interface PI = gameObject.AddComponent <PerceptronInterface>(); PI.PCT = PCT; }
void OnCollisionEnter(Collision col) { TutorialCowControl TPC = col.gameObject.GetComponent <TutorialCowControl>(); if (TPC != null && !Moving) { //The cow must eat at a certain angle if (Mathf.Abs(TPC.AngleToFood) > 180) { TPC.Death = true; MoveFood(); } else { TPC.Satiety += 15; MoveFood(); } } }