public override NeuralNode Clone() { ColorNode res = (ColorNode)NeuralNode.create(NodeType.FULLCOLOR); res.SetWeights(actualWeights, this.b); res.SetNonzeroIndices(); return(res); }
protected virtual void Awake(){ targetsInRange = new List<Unit> (); node = NeuralNode.create (NeuralNode.NodeType.FULLCOLOR); targetsSeen = 0; SetRange (this.range); transform.Find ("Range").gameObject.GetComponent<MeshRenderer> ().enabled = false; this.aimPoint = Instantiate (aimPoint); }
public override NeuralNode Clone() { GrayscaleNode res = (GrayscaleNode)NeuralNode.create(NodeType.GRAYSCALE); res.SetWeights(actualWeights, this.b); res.SetNonzeroIndices(); return(res); }
public override NeuralNode Clone() { ColorHistNode res = (ColorHistNode)NeuralNode.create(NodeType.COLORHIST); res.SetWeights(actualWeights, this.b); res.SetNonzeroIndices(); res.totalNegativeWeights = this.totalNegativeWeights; res.totalPositiveWeights = this.totalPositiveWeights; return(res); }
public void train() { if (castle.canPurchase(getPrice())) { // Start training! NeuralNode node = NeuralNode.create(neuralNodeType); cFire.node = node; float noise = getNoise(); for (int i = 1; i <= TOTAL_ENEMY_UNITS; i++) { for (int j = 0; j < getQuantityOfEnemy(i); j++) { Unit unit = uGen.MakeUnit(true, ENEMY_INDICES[i - 1], farOff, noise, true); if (unit is UnitAnimated) { UnitAnimated ua = (UnitAnimated)unit; Texture2D[] texes = ua.textures; int texIdx = j % texes.Length; ua.setTexture(texes[texIdx]); } node.AddToTrainingSet(unit, isEnemyTarget(i)); unit.DestroyMe(); } } for (int i = 1; i <= TOTAL_ALLY_UNITS; i++) { for (int j = 0; j < getQuantityOfAlly(i); j++) { Unit unit = uGen.MakeUnit(false, ALLY_INDICES[i - 1], farOff, noise, true); if (unit is UnitAnimated) { UnitAnimated ua = (UnitAnimated)unit; Texture2D[] texes = ua.textures; int texIdx = j % texes.Length; ua.setTexture(texes[texIdx]); } node.AddToTrainingSet(unit, isAllyTarget(i)); unit.DestroyMe(); } } node.LearnUnits(); castle.makePurchase(getPrice()); Time.timeScale = previousTimeScale; // Close window GetComponent <Canvas> ().enabled = false; Camera.main.GetComponent <BuildingPlacement> ().placeableBuildingOld.SetSelected(true); } }