public void UpdateRegion(float rectX, float rectZ) { for (int i = 0; i < agentCnt; i++) { agents[i].transform.Translate(transform.position - agents[i].transform.position); agents[i].transform.Translate(MathDefs.GetRandomNumber(-rectX, rectX), 0, MathDefs.GetRandomNumber(-rectZ, rectZ)); } }
void UpdateAction() { if (agentComponent.IsFighting()) { agentComponent.CurrAction = "fight"; if (bannerCarrier) { banner.SetActiveRecursively(false); } } else if (bannerCarrier) { banner.SetActiveRecursively(true); agentComponent.CurrAction = "protest"; } else { if (frameCnt % 300 == 0) //protesting -- update every 300 frames { int animId; string exp = affectComponent.GetEkmanEmotion(); if (exp.Equals("angry") || exp.Equals("sad")) { animId = MathDefs.GetRandomNumber(3); } else if (exp.Equals("happy")) { animId = 0; } else { animId = -1; //no action } if (animId == 0) { agentComponent.CurrAction = "clap"; } else if (animId == 1) { agentComponent.CurrAction = "cheer"; } else if (animId == 2) { agentComponent.CurrAction = "throw"; } else { agentComponent.CurrAction = ""; } } } }
void Start() { for (int i = 0; i < 32; i++) { _driveParams[i] = new DriveParams(); } _agentLeft = GameObject.Find("AgentPrefabLeft"); _agentRight = GameObject.Find("AgentPrefabRight"); if (!_agentLeft) { Debug.Log("AgentLeft prefab not found"); return; } if (!_agentRight) { Debug.Log("AgentRight prefab not found"); return; } _personality = UserInfo.Personality; #if WEBMODE _animInd = UserInfo.AnimInd; _qCnt = UserInfo.QCnt; #elif !WEBMODE _animInd = 1; _qCnt = 48; #endif _taskQInd = 0; //initial question's index _arePositionsSwapped = new bool[_qCnt * 2]; _isSubmittedStr = new string[_qCnt + 2]; _isSubmitted = new bool[_qCnt + 2]; _alreadyPlayed = new bool[_qCnt]; //compute effortCombination hashes for (int i = 0; i < 32; i++) { int val = _effortList[i, 3] + _effortList[i, 2] * 3 + _effortList[i, 1] * 9 + _effortList[i, 0] * 27; _effortCombination.Add(val, i); } for (int i = 0; i < _isSubmittedStr.Length; i++) { _isSubmittedStr[i] = "";//"Answer NOT submitted"; } for (int i = 0; i < _alreadyPlayed.Length; i++) { _alreadyPlayed[i] = false; } UpdateCameraBoundaries(); // _drivesAchieved = false; //Read all drive and shape parameters #if !WEBMODE for (int i = 0; i < 32; i++) { _driveParams[i].ReadValuesDrives(i); } #elif WEBMODE for (int i = 0; i < 32; i++) { this.StartCoroutine(_driveParams[i].GetValuesDrives(i, "funda")); } //wait till drives are achieved /* * _drivesAchieved = true; * for (int i = 0; i < 32; i++) //make sure all the drives are achieved * _drivesAchieved = _drivesAchieved && _driveParams[i].DrivesAchieved; * */ #endif //Select if positions are swapped in the beginning for (int i = 0; i < _arePositionsSwapped.Length / 2; i++) { if (MathDefs.GetRandomNumber(2) == 1) { //50% chance _arePositionsSwapped[i] = true; } else { _arePositionsSwapped[i] = false; } } Reset(); _firstQFirstPlay = true; _goldQ1Ind = MathDefs.GetRandomNumber(2, 4); _goldQ2Ind = MathDefs.GetRandomNumber(4, 6); _goldQ1Asked = _goldQ2Asked = false; _quality = 0; }
private void OnGUI() { GUI.skin = ButtonSkin; bool disableBefore = DisableLMA; DisableLMA = GUILayout.Toggle(DisableLMA, "Disable LMA"); if (disableBefore != DisableLMA) //a change has been made in the toggle { foreach (AnimationInfo a in _agentScripts) { a.DisableLMA = DisableLMA; } } GUI.color = Color.white; GUILayout.BeginArea(_dropDownRectAgents.DdRect); GUILayout.Label("Character"); _dropDownRectAgents.DdList = _agentScripts.Select(s => s.CharacterName).ToList(); _agentSelInd = _dropDownRectAgents.ShowDropDownRect(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(5, 20, 105, Screen.height)); GUILayout.Label("Personality"); GUI.color = Color.white; GUILayout.Label(""); for (int i = 0; i < 5; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("" + _persMin); GUILayout.Label("" + _personalityName[i]); GUILayout.Label("" + _persMax); GUILayout.EndHorizontal(); _personality[i] = _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i]; GUI.color = Color.white; GUI.backgroundColor = Color.white; _personality[i] = GUILayout.HorizontalSlider(_personality[i], _persMin, _persMax).Truncate(1); //Assign agent personality _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; string[] ocean = { "O", "C", "E", "A", "N" }; for (int j = 0; j < 5; j++) { if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == -1) { ocean[j] += "-"; } else if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == 1) { ocean[j] += "+"; } else { ocean[j] = ""; } } } GUI.color = Color.white; if (_driveParams[31].DrivesAchieved) { if (GUILayout.Button("Reset scene")) { Application.LoadLevel(Application.loadedLevel); } if (GUILayout.Button("Randomize")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = MathDefs.GetRandomNumber(-1f, 1f); } } } if (GUILayout.Button("Reset")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = 0; } } } if (GUILayout.Button("Assign All")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; } } } if (GUILayout.Button("Play")) { _walkIsOver = 0; int agentInd = 0; foreach (AnimationInfo t in _agentScripts) { t.AnimName = "walking"; ResetComponents(t); _persMapper.MapPersonalityToMotion(t.GetComponent <PersonalityComponent>()); //calls initkeypoints, which stops the animation Play(t); GUI.color = Color.white; agentInd++; } } if (GUILayout.Button("Record")) { _walkIsOver = 0; GameObject.Find("Camera").GetComponent <Screenshot>().IsRunning = true; Time.timeScale = 0.5f; int agentInd = 0; foreach (AnimationInfo t in _agentScripts) { t.AnimName = "walking"; ResetComponents(t); _persMapper.MapPersonalityToMotion(t.GetComponent <PersonalityComponent>()); //calls initkeypoints, which stops the animation Play(t); GUI.color = Color.white; agentInd++; } } //we need to update after play because playanim resets torso parameters for speed etc. when animinfo is reset } GUI.color = Color.yellow; GUILayout.Label("S:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[0] + " W:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[1] + " T:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[2] + " F:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[3]); GUILayout.EndArea(); }
private void OnGUI() { GUI.color = Color.white; GUILayout.BeginArea(_dropDownRectAgents.DdRect); GUILayout.Label("Character"); _dropDownRectAgents.DdList = _agentScripts.Select(s => s.CharacterName).ToList(); _agentSelInd = _dropDownRectAgents.ShowDropDownRect(); GUILayout.EndArea(); GUILayout.BeginArea(_dropDownRectAnimNames.DdRect); GUILayout.Label("Animation"); _dropDownRectAnimNames.DdList = _agentScripts[_agentSelInd].AnimNames.ToList(); int ind = _dropDownRectAnimNames.ShowDropDownRect(); _agentScripts[_agentSelInd].AnimName = _agentScripts[_agentSelInd].AnimNames[ind]; GUILayout.EndArea(); GUILayout.BeginArea(new Rect(5, 20, 105, Screen.height)); GUILayout.Label("Personality"); GUI.color = Color.white; GUILayout.Label(""); for (int i = 0; i < 5; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("" + _persMin); GUILayout.Label("" + _personalityName[i]); GUILayout.Label("" + _persMax); GUILayout.EndHorizontal(); _personality[i] = _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i]; GUI.color = Color.white; GUI.backgroundColor = Color.white; _personality[i] = GUILayout.HorizontalSlider(_personality[i], _persMin, _persMax).Truncate(1); //Assign agent personality _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; string[] ocean = { "O", "C", "E", "A", "N" }; for (int j = 0; j < 5; j++) { if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == -1) { ocean[j] += "-"; } else if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == 1) { ocean[j] += "+"; } else { ocean[j] = ""; } } /* * _agentSel.AgentText.text = string.Format(ocean[0] + " " + ocean[1] + " " + ocean[2] + " " + ocean[3] + " " + ocean[4]); * * * _agentSel.AgentText.text += string.Format("\nS: {0:0.00} W: {1:0.00} T: {2:0.00} F: {3:0.00}", _agentSel.Effort[0], _agentSel.Effort[1], _agentSel.Effort[2], _agentSel.Effort[3]); */ } GUI.color = Color.white; _lockHand = GUILayout.Toggle(_lockHand, "Lock hand"); foreach (AnimationInfo a in _agentScripts) { a.GetComponent <IKAnimator>().LockHand = _lockHand; } if (_driveParams[31].DrivesAchieved) { if (GUILayout.Button("Reset scene")) { Application.LoadLevel(Application.loadedLevel); } if (GUILayout.Button("Randomize")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = MathDefs.GetRandomNumber(-1f, 1f); } } } if (GUILayout.Button("Reset")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = 0; } } } if (GUILayout.Button("Assign All")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; } } } if (GUILayout.Button("Assign All Variation")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = _personality[i] + MathDefs.GetRandomNumber(-0.2f, 0.2f); if (a.GetComponent <PersonalityComponent>().Personality[i] > 1) { a.GetComponent <PersonalityComponent>().Personality[i] = 1; } else if (a.GetComponent <PersonalityComponent>().Personality[i] < -1) { a.GetComponent <PersonalityComponent>().Personality[i] = -1; } } } } if (GUILayout.Button("Play")) { PlayAgents(); } if (GUILayout.Button("Record")) { GameObject.Find("Main Camera").GetComponent <Screenshot>().IsRunning = true; Time.timeScale = 0.25f; PlayAgents(); } //we need to update after play because playanim resets torso parameters for speed etc. when animinfo is reset } GUI.color = Color.yellow; GUILayout.Label("S:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[0] + " W:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[1] + " T:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[2] + " F:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[3]); GUILayout.EndArea(); }
void Start() { UserInfo.Hit = 5; _quality = 0; for (int i = 0; i < _agentsLeft.Length; i++) { _agentsLeft[i] = GameObject.Find("AgentPrefabLeft" + i).GetComponent <AnimationInfo>(); _agentsRight[i] = GameObject.Find("AgentPrefabRight" + i).GetComponent <AnimationInfo>(); //Make all invisible so that users can't see the models _agentsLeft[i].gameObject.SetActive(false); _agentsRight[i].gameObject.SetActive(false); } //TODO: Hits start from 0!! _agentsLeft[(UserInfo.Hit / 3)].gameObject.SetActive(true); _agentsRight[(UserInfo.Hit / 3)].gameObject.SetActive(true); for (int i = 0; i < 32; i++) { _driveParams[i] = new DriveParams(); } _qCnt = 5; #if DEBUGMODE UserInfo.Hit = 0; #endif _taskQInd = 4; //_taskQInd = 0; //initial question's index _arePositionsSwapped = new bool[_qCnt]; _isSubmittedStr = new string[_qCnt]; _isSubmitted = new bool[_qCnt]; _alreadyPlayed = new bool[_qCnt]; for (int i = 0; i < _isSubmittedStr.Length; i++) { _isSubmittedStr[i] = "";//"Answer NOT submitted"; } for (int i = 0; i < _alreadyPlayed.Length; i++) { _alreadyPlayed[i] = false; } UpdateCameraBoundaries(); // _drivesAchieved = false; //Read all drive and shape parameters #if !WEBMODE for (int i = 0; i < 32; i++) { _driveParams[i].ReadValuesDrives(i); } #elif WEBMODE for (int i = 0; i < 32; i++) { this.StartCoroutine(_driveParams[i].GetValuesDrives(i, "funda")); } #endif //Select if positions are swapped in the beginning for (int i = 0; i < _arePositionsSwapped.Length / 2; i++) { if (MathDefs.GetRandomNumber(2) == 1) { //50% chance _arePositionsSwapped[i] = true; } else { _arePositionsSwapped[i] = false; } } _persMapper = new PersonalityMapper(); _firstQFirstPlay = true; _agentLeft = GameObject.Find("AgentPrefabLeft" + (UserInfo.Hit / 3)).GetComponent <AnimationInfo>(); _agentRight = GameObject.Find("AgentPrefabRight" + (UserInfo.Hit / 3)).GetComponent <AnimationInfo>(); // _agentLeft = new Agent("AgentPrefabLeft" + (UserInfo.Hit/3)); // _agentRight = new Agent("AgentPrefabRight" + (UserInfo.Hit / 3)); if ((UserInfo.Hit % 3) == 2) //walking { _agentLeft.transform.position -= Vector3.forward * 4; _agentRight.transform.position -= Vector3.forward * 4; } Reset(_agentLeft); Reset(_agentRight); }
private void OnGUI() { GUI.skin = ButtonSkin; bool disableBefore = DisableLMA; DisableLMA = GUILayout.Toggle(DisableLMA, "Disable LMA"); if (disableBefore != DisableLMA) //a change has been made in the toggle { foreach (AnimationInfo a in _agentScripts) { a.DisableLMA = DisableLMA; } } GUI.color = Color.white; GUILayout.BeginArea(_dropDownRectAgents.DdRect); GUILayout.Label("Character"); _dropDownRectAgents.DdList = _agentScripts.Select(s => s.CharacterName).ToList(); _agentSelInd = _dropDownRectAgents.ShowDropDownRect(); GUILayout.EndArea(); GUILayout.BeginArea(_dropDownRectAnimNames.DdRect); GUILayout.Label("Animation"); _dropDownRectAnimNames.DdList = _agentScripts[_agentSelInd].AnimNames.ToList(); int ind = _dropDownRectAnimNames.ShowDropDownRect(); _agentScripts[_agentSelInd].AnimName = _agentScripts[_agentSelInd].AnimNames[ind]; GUILayout.EndArea(); GUILayout.BeginArea(_dropDownRectNationality.DdRect); GUILayout.Label("Nationality"); _dropDownRectNationality.DdList = _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().listNationality(); int ind_nationality = _dropDownRectNationality.ShowDropDownRect(); nationality_s = _dropDownRectNationality.DdList[ind_nationality]; _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Culture = nationality_s; GUILayout.EndArea(); GUILayout.BeginArea(_dropDownRectProfession.DdRect); GUILayout.Label("Profession"); _dropDownRectProfession.DdList = _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().listProfession(); int ind_profession = _dropDownRectProfession.ShowDropDownRect(); profession_s = _dropDownRectProfession.DdList[ind_profession]; _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Profession = profession_s; GUILayout.EndArea(); GUILayout.BeginArea(new Rect(5, 20, 105, Screen.height)); GUILayout.Label("Personality"); GUI.color = Color.white; GUILayout.Label(""); for (int i = 0; i < 5; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("" + _persMin); GUILayout.Label("" + _personalityName[i]); GUILayout.Label("" + _persMax); GUILayout.EndHorizontal(); _personality[i] = _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i]; GUI.color = Color.white; GUI.backgroundColor = Color.white; _personality[i] = GUILayout.HorizontalSlider(_personality[i], _persMin, _persMax).Truncate(1); //Assign agent personality _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; string[] ocean = { "O", "C", "E", "A", "N" }; for (int j = 0; j < 5; j++) { if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == -1) { ocean[j] += "-"; } else if (_agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Personality[j] == 1) { ocean[j] += "+"; } else { ocean[j] = ""; } } /* * _agentSel.AgentText.text = string.Format(ocean[0] + " " + ocean[1] + " " + ocean[2] + " " + ocean[3] + " " + ocean[4]); * * * _agentSel.AgentText.text += string.Format("\nS: {0:0.00} W: {1:0.00} T: {2:0.00} F: {3:0.00}", _agentSel.Effort[0], _agentSel.Effort[1], _agentSel.Effort[2], _agentSel.Effort[3]); */ } GUI.color = Color.white; _lockHand = GUILayout.Toggle(_lockHand, "Lock hand"); foreach (AnimationInfo a in _agentScripts) { a.GetComponent <IKAnimator>().LockHand = _lockHand; } GUILayout.BeginHorizontal(); GUILayout.Label("" + 0); GUILayout.Label("W"); GUILayout.Label("" + 1); GUILayout.EndHorizontal(); GUI.color = Color.white; GUI.backgroundColor = Color.white; n_p_weight = GUILayout.HorizontalSlider(n_p_weight, 0, 1).Truncate(1); if (n_p_weight != prev_n_p_weight) { prev_n_p_weight = n_p_weight; foreach (AnimationInfo a in _agentScripts) { a.GetComponent <PersonalityComponent>().BlendWeight = n_p_weight; } } if (_driveParams[31].DrivesAchieved) { if (GUILayout.Button("Reset scene")) { Application.LoadLevel(Application.loadedLevel); } if (GUILayout.Button("Randomize")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = MathDefs.GetRandomNumber(-1f, 1f); } } } if (GUILayout.Button("Reset")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = 0; } } } if (GUILayout.Button("Assign All")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = _personality[i]; } //will cause small diff in ocean values if I do this, for unknown reasons: so I comment this out //a.GetComponent<PersonalityComponent>().Culture = nationality_s; //a.GetComponent<PersonalityComponent>().Profession = profession_s; } } if (GUILayout.Button("Assign All Variation")) { foreach (AnimationInfo a in _agentScripts) { for (int i = 0; i < 5; i++) { a.GetComponent <PersonalityComponent>().Personality[i] = _personality[i] + MathDefs.GetRandomNumber(-0.2f, 0.2f); if (a.GetComponent <PersonalityComponent>().Personality[i] > 1) { a.GetComponent <PersonalityComponent>().Personality[i] = 1; } else if (a.GetComponent <PersonalityComponent>().Personality[i] < -1) { a.GetComponent <PersonalityComponent>().Personality[i] = -1; } } } } if (GUILayout.Button("Play")) { int agentInd = 0; foreach (AnimationInfo t in _agentScripts) { ResetComponents(t); _persMapper.MapPersonalityToMotion(t.GetComponent <PersonalityComponent>()); //calls initkeypoints, which stops the animation Play(t); GUI.color = Color.white; agentInd++; } _persMapper.MapAnimSpeeds(_agentScripts, 0.9f, 1.3f); //map them to the range } if (GUILayout.Button("Record")) { GameObject.Find("Camera").GetComponent <Screenshot>().IsRunning = true; Time.timeScale = 0.25f; int agentInd = 0; foreach (AnimationInfo t in _agentScripts) { ResetComponents(t); _persMapper.MapPersonalityToMotion(t.GetComponent <PersonalityComponent>()); //calls initkeypoints, which stops the animation Play(t); GUI.color = Color.white; agentInd++; } _persMapper.MapAnimSpeeds(_agentScripts, 0.9f, 1.3f); //map them to the range } //we need to update after play because playanim resets torso parameters for speed etc. when animinfo is reset } GUI.color = Color.yellow; GUILayout.Label("S:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[0] + " W:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[1] + " T:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[2] + " F:" + _agentScripts[_agentSelInd].GetComponent <PersonalityComponent>().Effort[3]); GUILayout.EndArea(); }
void Start() { for (int i = 0; i < 32; i++) { _arm[i] = new Vector3[2]; } _agentLeft = GameObject.Find("AgentPrefabLeft"); _agentRight = GameObject.Find("AgentPrefabRight"); if (!_agentLeft) { Debug.Log("AgentLeft prefab not found"); return; } if (!_agentRight) { Debug.Log("AgentRight prefab not found"); return; } _qInd = 0; //compute effortCombination hashes for (int i = 0; i < 32; i++) { int val = _effortList[i, 3] + _effortList[i, 2] * 3 + _effortList[i, 1] * 9 + _effortList[i, 0] * 27; _effortCombination.Add(val, i); } for (int i = 0; i < _isSubmittedStr.Length; i++) { _isSubmittedStr[i] = "Answer NOT submitted"; } UpdateCameraBoundaries(); for (int i = 0; i < 18; i++) { _shapeParams[i] = new float[6]; } //Read all drive and shape parameters #if !WEBMODE for (int i = 0; i < 32; i++) { ReadValuesDrives(i); } for (int i = 5; i >= 0; i--) { ReadValuesShapes(i); } #elif WEBMODE for (int i = 0; i < 32; i++) { this.StartCoroutine(GetValuesDrives(i)); } for (int i = 5; i >= 0; i--) { this.StartCoroutine(GetValuesShapes(i)); } for (int i = 0; i < 2; i++) { for (int j = 0; j < 48; j++) { this.StartCoroutine(GetValuesSubmitted(j, i)); } } #endif //Read all shape parameters //Select if positions are swapped in the beginning for (int i = 0; i < _arePositionsSwapped.Length; i++) { if (MathDefs.GetRandomNumber(2) == 1) //50% chance { _arePositionsSwapped[i] = true; } else { _arePositionsSwapped[i] = false; } } Reset(); _leftPos = _agentLeft.transform.position; _rightPos = _agentRight.transform.position; }