/// <summary> /// Reset the specified teamName and material. /// </summary> /// <param name="teamName">Team name.</param> /// <param name="material">Material.</param> public void Reset(string teamName, Color color) { MeshRenderer[] renderComponents = this.gameObject.GetComponents <MeshRenderer>(); if (renderComponents.Length != 1) { LogUtility.LogErrorFormat("Object had {0} render components", renderComponents.Length); } this.transform.localScale = new Vector3( StaticController.GlobalShapeHorizontalScale, this.transform.localScale.y, StaticController.GlobalShapeHorizontalScale); renderComponents[0].material.color = color; this.gameObject.SetActive(true); this.TeamName = teamName; this.genome = GenePoolManager.GetData(teamName); // Key read only variables this.Health = InitialHealth; this.AttackStrength = InitialAttackStrength; this.GrowFoodStrength = InitialGrowFoodStrength; // Key read write variables this.HelperInt1 = 0; this.HelperInt2 = 0; this.HelperBool1 = 0; this.HelperBool2 = 0; this.HelperGridDirection1 = (byte)GridDirectionEnum.North; this.HelperGridDirection2 = (byte)GridDirectionEnum.North; }
void FixedUpdate() { bool forceEarlyRefresh = GameObjectGrid.EveryoneIsDead() || GameObjectGrid.GridIsMonoChromatic(); if (frameCounter >= this.FramesPerIteration || forceEarlyRefresh) { lock (CommonHelperMethods.GlobalStateLock) { // Everyone wins GenePoolManager.RefreshTeamDNA(); } this.frameCounter = 0; } }