// Update is called once per frame void Update() { if (timePerStop > 0) { if (!stopped && Time.time > timeOfLastStopOrGo + timeBetweenStop) { stopped = true; timeOfLastStopOrGo = Time.time; nav.SetDestination(transform.position); } else if (stopped && Time.time > timeOfLastStopOrGo + timePerStop) { stopped = false; timeOfLastStopOrGo = Time.time; nav.SetDestination(destination); } } if (Time.time >= nextConfoundingTime) { foreach (KeyValuePair <NeuralNode, List <int> > kvp in towersToConfound) { NeuralNode node = kvp.Key; int[] nonzeroIndices = node.GetNonzeroIndices(); if (nonzeroIndices != null && nonzeroIndices.Length > 0) { float numCallsToConfound = intendedConfoundingTime / Time.deltaTime; int numConfoundings = (int)(nonzeroIndices.Length / numCallsToConfound); for (int i = 0; i < numConfoundings; i++) { List <int> preconfoundedIndices = node.GetConfoundedIndices(); int index = nonzeroIndices [Random.Range(0, nonzeroIndices.Length)]; if (!kvp.Value.Contains(index) && !preconfoundedIndices.Contains(index)) { if (index == -1) { node.b = ConfoundB(node.b); } else { ConfoundWeights(node.weights, index); } kvp.Value.Add(index); node.AddToConfoundedIndices(index); } } } } nextConfoundingTime = Time.time + confoundInterval; } Vector3 rangeSize = rangeIndicator.localScale; float rangeScale = rangeSize.x; if (rangeSize.x > 7 * 2 * range) { rangeScale = 0f; } Vector3 newRangeScale = new Vector3(rangeScale + Time.deltaTime * rangeSpeed, 0, rangeScale + Time.deltaTime * rangeSpeed); rangeIndicator.localScale = newRangeScale; }