public override void Update() { if (mManager.mZigManager.has_user() && mManager.mZigManager.is_skeleton_tracked_alternative()) { CurrentPose = ProGrading.snap_pose(mManager); } else { CurrentPose = mManager.mReferences.mDefaultPose.to_pose(); } if (GS == GameState.NORMAL) { if (KeyMan.GetKeyDown("Pause")) { if (!mModeNormalPlay.Paused) { mManager.GameEventDistributor("PAUSE", null); } else { mManager.GameEventDistributor("RESUME", null); } } if (!mModeNormalPlay.Paused) { mModeNormalPlay.update(); } } else if (GS == GameState.TEST) { mModeTesting.update(); } else if (GS == GameState.SIMIAN) { mModeSimian.update(); } else if (GS == GameState.CHALLENGE) { mModeChallenge.update(); } if (GS != GameState.SIMIAN) { //reader connected and no user if (!mManager.mZigManager.has_user() && mManager.mZigManager.is_reader_connected() == 2) { mIdleTimer.update(Time.deltaTime); } else { mIdleTimer.reset(); } if (mIdleTimer.isExpired()) { mIdleTimer.reset(); mManager.restart_game(); } } }
public void bulk_pose_bundle_loaded_callback(AssetBundle aBundle) { var bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); var stream = new System.IO.MemoryStream((aBundle.LoadAsset("POSEDICT") as TextAsset).bytes); var dict = bf.Deserialize(stream) as Dictionary <string, string>; //Debug.Log("bulk poses"); foreach (CharacterIndex e in CharacterIndex.sAllCharacters) { if (e == CharacterIndex.sGrave) { continue; } string txtName = "info_" + e.StringIdentifier; if (dict.ContainsKey(txtName)) { //Debug.Log ("loaded character info " + txtName); mCharacterHelper.Characters[e].CharacterInfo = NUPD.CharacterInformationProcessor.process_character(dict[txtName]); //kind of a hack. //TODO uncomment this when you get new character packages in... GameConstants.INDEX_TO_SHORT_NAME[e] = mCharacterHelper.Characters[e].CharacterInfo.ShortName; //GameConstants.INDEX_TO_FULL_NAME[e] = mCharacterHelper.Characters[e].CharacterInfo.LongName; GameConstants.INDEX_TO_DESCRIPTION[e] = mCharacterHelper.Characters[e].CharacterInfo.Description; } else { throw new UnityException("No info found for " + txtName); //Debug.Log ("no info found for " + txtName); //mCharacterHelper.Characters[e].CharacterInfo = NUPD.CharacterInformation.default_character_info(e); } } //TODO CAN DELETE //this is now called inside of ModeNormalPlay.reset_stats_and_difficulties //fetus_difficulty_shuffle_hack(); foreach (CharacterIndex e in CharacterIndex.sAllCharacters) { //Debug.Log ("loaded pose for " + e.StringIdentifier); for (int i = 0; i < 4; i++) { for (int j = 1; j < 10; j++) //assuming no mroe than 10 poses per animatino { string s = construct_pose_string(e, i, j); if (dict.ContainsKey(s)) { //Debug.Log("loaded " + s); mPoses[s] = ProGrading.read_pose(dict[s]); } } } } aBundle.Unload(true); //don't need this anymore I don't ithnk... mPosesLoaded = true; //Debug.Log("end bulk poses"); }
// public void load_possible_choice_poses() { mPossibleChoicePoses = new Pose[ManagerManager.Manager.mReferences.mPossiblePoses.Length]; for (int i = 0; i < mPossibleChoicePoses.Length; i++) { mPossibleChoicePoses[i] = ProGrading.read_pose(ManagerManager.Manager.mReferences.mPossiblePoses[i]); } }
public void save_to_folder(string aPrefix, string aFolder) { int i = 1; foreach (var e in poses) { ProGrading.write_pose_to_file(e, aFolder + "/" + aPrefix + "_" + i + ".txt"); i++; } }
public static PoseAnimation load_from_folder(string aFolder) { Debug.Log("trying to load poses from folder " + aFolder); PoseAnimation r = new PoseAnimation(); //Debug.Log(Directory.GetFiles(aFolder).Where(e => Path.GetExtension(e) == ".txt").Count()); foreach (string e in Directory.GetFiles(aFolder).Where(e => System.IO.Path.GetExtension(e) == ".txt")) { //string text = (new StreamReader(e)).ReadToEnd(); r.poses.Add(ProGrading.from_file(e)); } return(r); }
public void write_pose(string aFilename, bool aManual) { if (aManual) { ProGrading.write_pose_to_file(get_current_pose(), aFilename); } else { //if (mManager.mZigManager.has_user()) { ProGrading.write_pose_to_file(ProGrading.snap_pose(mManager), aFilename); } } }
public void update(Pose aCurrent, Pose aTarget) { //TODO make global?? float lambda = GRADE_INTERP; Dictionary <ZgJointId, float> newScore = ProGrading.advanced_grade_pose(aCurrent, aTarget); if (mCurrentScore == null) { mCurrentScore = newScore; } mLastScore = mCurrentScore; mCurrentScore = new Dictionary <ZgJointId, float>(newScore); foreach (KeyValuePair <ZgJointId, float> e in newScore) { mCurrentScore[e.Key] = mLastScore[e.Key] * lambda + newScore[e.Key] * (1 - lambda); } }
public void create_particles(AdvancedGrading aGrade, bool continuous = false) { ManagerManager man = ManagerManager.Manager; BodyManager activeBody = man.mBodyManager; /*foreach(var e in sJointGroups) * { * float score = ProGrading.grade_to_perfect(aGrade.joint_aggregate_score(e.Value)); * //if(!continuous) * //mParticles.emit_point(score,activeBody.mFlat.get_body_part_position(e.Key),200); * //else * mParticles.emit_continuous(score,activeBody.mFlat.get_body_part_position(e.Key)); * }*/ /* * foreach(var e in sConnectedGroups) * { * float score = ProGrading.grade_to_perfect(aGrade.joint_score(e.Key)); * Vector3[] path = new Vector3[e.Value.Length+1]; * path[0] = activeBody.mFlat.get_body_part_position(e.Value[0]); * path[1] = activeBody.mFlat.get_body_part_position(e.Key); * if(e.Value.Length == 2) * path[2] = activeBody.mFlat.get_body_part_position(e.Value[1]); * PolygonalPath pPath = new PolygonalPath(path); * * for(int i = 0; i < pPath.PathLength/20f; i++) * { * mParticles.emit_continuous(score,pPath.evaluate((float)i*20/pPath.PathLength)); * } * * if(pPath.PathLength == 0) * mParticles.emit_continuous(score,pPath.evaluate(0)); * }*/ if (!continuous) { bool fever = man.mGameManager.mModeNormalPlay.IsFever; float grade = ProGrading.grade_to_perfect(aGrade.CurrentGrade); int inc = Mathf.Clamp((int)(5 * grade), 0, 4); if (inc < 1) { //TODO sad particles } if (inc >= 2 && inc < 3) { //mParticles.emit_ring("silver",5,activeBody.mFlat.get_body_part_position(ZigJointId.Torso),600, 1.5f); mParticles.emit_ring("silver", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 900, 1.5f); } if (inc >= 3 && inc < 4) { mParticles.emit_ring("silver", 5, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 700, 1.5f); mParticles.emit_ring("gold", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1000, 2f); } if (inc == 4) { if (grade > GameConstants.playSuperCutoff && fever) { mParticles.emit_ring("gold", 20, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 2500, 2f); //mParticles.emit_ring("gold",15,activeBody.mFlat.get_body_part_position(ZigJointId.Torso),1500,3f); mParticles.emit_ring("silver", 12, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1900, 3f); mParticles.emit_ring("gold", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1200, 4f); mParticles.emit_ring("silver", 10, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 600, 1.5f); } else { mParticles.emit_ring("gold", 12, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1900, 4f); mParticles.emit_ring("silver", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1200, 1.5f); mParticles.emit_ring("gold", 10, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 600, 3f); } } //float ag = (grade-0.4f)*(grade-0.4f); //int count = (int)(100*ag); /* * if(grade > 0.6f) * mParticles.emit_point(count*1/3, activeBody.mFlat.get_body_part_position(ZigJointId.Torso),700); * if(grade > 0.8f) * mParticles.emit_point(count*2/3, activeBody.mFlat.get_body_part_position(ZigJointId.Torso),1000); */ } //TODO test this.. if (continuous) { //if(man.mGameManager.mModeNormalPlay.IsFever) { //TODO this is the wrong camera lol... //FlatCameraManager cam = ManagerManager.Manager.mGameManager.mModeNormalPlay.mFlatCamera; //mParticles.emit_line("gold",1,cam.get_point(-1f,1.1f),cam.get_point(1f,1.1f),2); } } //mParticles.emit_rect(grade.CurrentScore,new Rect }
//textasset public static Pose to_pose(this TextAsset aAsset) { return(ProGrading.read_pose(aAsset)); }
public void update() { //create the gui if (Gui == null) { Gui = mManager.gameObject.AddComponent <AuthoringGuiBehaviour>(); Gui.mTesting = this; } //update the character if (Gui.useKinect && NGM.mManager.mZigManager.is_reader_connected() == 2 && NGM.CurrentPose != null && mManager.mBodyManager.mFlat != null) //make sure a character is in fact loaded, this can apparently happen in testing scene. { mManager.mBodyManager.set_target_pose(NGM.CurrentPose); } else if (!Gui.useKinect) { mManager.mBodyManager.keyboard_update(); } if (NGM.CurrentPoseAnimation != null) { NGM.CurrentTargetPose = NGM.CurrentPoseAnimation.get_pose(Time.time); mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose); float grade = ProGrading.grade_pose(NGM.CurrentPose, NGM.CurrentTargetPose); grade = ProGrading.grade_to_perfect(grade); //TODO do something with grade } //if we are annoyed by the pose.. if (Input.GetKeyDown(KeyCode.Alpha9)) { if (NGM.CurrentPoseAnimation == null) { NGM.CurrentPoseAnimation = new PerformanceType(mCurrentPoseAnimation, mLastPoseMode); } else { NGM.CurrentPoseAnimation = null; } } //TODO DELETE /* * if(Input.GetKeyDown(KeyCode.Space)) * { * string folderPrefix = ""; * string output = ""; * if(mManager.mZigManager.is_reader_connected() != 2){ * output = NGM.CurrentCharacterIndex.StringIdentifier + "_man_" + mLastWrite; * mManager.mBodyManager.write_pose(folderPrefix + output + ".txt",true); * } else { * output = NGM.CurrentCharacterIndex.StringIdentifier + "_kinect_" + mLastWrite; * mManager.mBodyManager.write_pose(folderPrefix + output + ".txt",false); * } * mManager.take_screenshot(folderPrefix + output+".png",mManager.mCameraManager.MainBodyCamera); * mLastWrite++; * }*/ //switch to cutscene, note, this hides all the character stuff, not disable it if (Input.GetKeyDown(KeyCode.Alpha5)) { if (NGM.CurrentCharacterLoader.has_cutscene(mLastCutscene)) { mManager.mBodyManager.transition_character_out(); mManager.mTransparentBodyManager.transition_character_out(); mManager.mBackgroundManager.load_cutscene(mLastCutscene, NGM.CurrentCharacterLoader); //cutscene music if (mLastCutscene == 1) { mManager.mMusicManager.play_sound_effect("cutBad"); mManager.mMusicManager.play_cutscene_music(NGM.CurrentCharacterLoader.Images.cutsceneMusic[0]); } else if (mLastCutscene == 0) { mManager.mMusicManager.play_sound_effect("cutGood"); mManager.mMusicManager.play_cutscene_music(NGM.CurrentCharacterLoader.Images.cutsceneMusic[1]); } else if (mLastCutscene == 4) { mManager.mMusicManager.play_sound_effect("cutDie"); mManager.mMusicManager.play_cutscene_music(NGM.CurrentCharacterLoader.Images.deathMusic); } ManagerManager.Manager.mDebugString = "loaded cutscene " + mLastCutscene; mManager.mDebugString = "loaded cutscene " + mLastCutscene; } else { mManager.mDebugString = "missing cutscene " + mLastCutscene; } mLastCutscene = (mLastCutscene + 1) % 5; } //TODO DELETE /* * if(Input.GetKeyDown(KeyCode.Alpha6)) * { * string[] dirs = System.IO.Directory.GetDirectories("POSETEST"); * NGM.CurrentPoseAnimation = new PerformanceType(PoseAnimation.load_from_folder(dirs[mLastPoseFolder% dirs.Length]),new CharacterIndex(2,0)); * mManager.mDebugString = "pose folder: " + dirs[mLastPoseFolder% dirs.Length]; * mLastPoseFolder++; * * NGM.CurrentPoseAnimation.PT = mLastPoseMode; * NGM.CurrentPoseAnimation.ChangeTime = mLastPoseSpeed; * }*/ if (Input.GetKeyDown(KeyCode.A) && NGM.CurrentPoseAnimation != null) { mLastPoseMode = (PerformanceType.PType)(((int)mLastPoseMode + 1) % (int)PerformanceType.PType.COUNT); ManagerManager.Manager.mDebugString = "pose mode is: " + mLastPoseMode.ToString(); NGM.CurrentPoseAnimation.PT = mLastPoseMode; } if (Input.GetKey(KeyCode.S) && NGM.CurrentPoseAnimation != null) { mLastPoseSpeed = (mLastPoseSpeed + Time.deltaTime * 2.5f) % 10; ManagerManager.Manager.mDebugString = "pose time is: " + mLastPoseSpeed; NGM.CurrentPoseAnimation.ChangeTime = mLastPoseSpeed; } //TODO DELETE /* * if(Input.GetKeyDown(KeyCode.Alpha8)) * { * mManager.mDebugString = "Loaded poses for difficulty " + ((++mLastDiff)%4); * NGM.CurrentPoseAnimation = new PerformanceType(mManager.mCharacterBundleManager.get_pose(NGM.CurrentCharacterIndex,mLastDiff%4), new CharacterIndex(2,0)); //forces it to be switch * NGM.CurrentPoseAnimation.set_change_time(GameConstants.difficultyToChangeTime[mLastDiff%4]); * } * * * //TODO DELETE * int choice = -1; * if(Input.GetKeyDown(KeyCode.Alpha1)) * { * choice = 0; * } * else if(Input.GetKeyDown(KeyCode.Alpha2)) * { * choice = 1; * } * else if(Input.GetKeyDown(KeyCode.Alpha3)) * { * choice = 2; * } * else if(Input.GetKeyDown(KeyCode.Alpha4)) * { * choice = 3; * } * bool shift = Input.GetKey(KeyCode.LeftShift); * * if(choice != -1) * { * if(shift) * { * if(NGM.CurrentCharacterIndex.LevelIndex > 0) * if(!(NGM.CurrentCharacterIndex.LevelIndex == 1 && choice != 0)) //if we are level 1 make sure we don't go back to an invalid character * mManager.mAssetLoader.new_load_character(NGM.CurrentCharacterIndex.get_past_neighbor(choice).StringIdentifier,mManager.mCharacterBundleManager); * } * else * { * if(NGM.CurrentCharacterIndex.LevelIndex < 7) * mManager.mAssetLoader.new_load_character(NGM.CurrentCharacterIndex.get_future_neighbor(choice).StringIdentifier,mManager.mCharacterBundleManager); * } * }*/ }
public void update_PLAY() { TimeRemaining -= KeyMan.GetKey("Fast") ? Time.deltaTime * 5 : Time.deltaTime; if (NGM.CurrentPose != null) //this should never happen but just in case { if (KeyMan.GetKey("Perfect")) { mManager.mBodyManager.set_target_pose(NGM.CurrentTargetPose); } else { mManager.mBodyManager.set_target_pose(NGM.CurrentPose); } } //this basically means we aren't 0 or 100 or 999 if (NGM.CurrentPoseAnimation != null && NGM.CurrentCharacterIndex.LevelIndex != 0) { NGM.CurrentTargetPose = NGM.CurrentPoseAnimation.get_pose(Time.time); mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose); mGrading.update(mManager.mBodyManager.get_current_pose(), mManager.mTransparentBodyManager.get_current_pose()); float grade = ProGrading.grade_pose(mManager.mBodyManager.get_current_pose(), mManager.mTransparentBodyManager.get_current_pose()); grade = ProGrading.grade_to_perfect(grade); //old smooth grading /* * float newGrade = mLastGrade*0.95f + grade*0.05f; * if(newGrade < mLastGrade) * mLastGrade = Mathf.Max(newGrade,mLastGrade - Time.deltaTime/6f); * else mLastGrade = newGrade; * grade = mLastGrade;*/ //new smooth grading, this version gives grace to sudden drops in performance if (grade < mLastGrade) { float newGrade = mLastGrade * 0.95f + grade * 0.05f; if (newGrade < mLastGrade) { grade = Mathf.Max(newGrade, mLastGrade - Time.deltaTime / 2f); } else { grade = newGrade; } } mLastGrade = grade; bool switchEffect = false; if (PercentTimeCompletion > 0.01f) { mParticles.create_particles(mGrading, true); if (GameConstants.NEW_POSE_SWITCHING) { //TODO test if switch conditions are right //TODO switch } else { if (NGM.CurrentPoseAnimation.does_pose_change_precoginitive(Time.time, Time.deltaTime, 0.07f)) { switchEffect = true; //TODO give 1 second of bonus score for being close right when pose switches } } } if (TimeRemaining > 0) //insurance, something funny could happen if music runs slightly longer than it should. { CurrentPerformanceStat.update_score(PercentTimeCompletion, grade); } //TODO needs to be tested //improve score for good switches if (switchEffect) { CurrentPerformanceStat.adjust_score(PercentTimeCompletion, grade * GameConstants.switchBonusScoreMultiplier, NGM.CurrentPoseAnimation.ChangeTime); } //trigger effects after adjusting score if (switchEffect) { mGiftManager.capture_player(); mParticles.create_particles(mGrading); if (grade > GameConstants.playSuperCutoff && IsFever) { mManager.mMusicManager.play_sound_effect("pose5", 0.6f); } else { mManager.mMusicManager.play_sound_effect("pose" + Mathf.Clamp((int)(5 * grade), 0, 4), 0.8f); } } //mManager.mCameraManager.set_camera_effects(grade); //update score mInterfaceManager.update_bb_score(TotalScore); } else if (NGM.CurrentCharacterIndex.LevelIndex == 0 && true) //fetus { if (NGM.CurrentTargetPose != null) { mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose); float grade = ProGrading.grade_pose(mManager.mBodyManager.get_current_pose(), NGM.CurrentTargetPose); //should be mManager.mTransparentBodyManager.get_current_pose() but it does not matter grade = ProGrading.grade_to_perfect(grade); //this is a total hack, but we don't use mTotalScore for the fetus anyways FieldInfo scoreProp = typeof(PerformanceStats).GetField("mTotalScore", BindingFlags.NonPublic | BindingFlags.Instance); float oldGrade = (float)scoreProp.GetValue(CurrentPerformanceStat); float newGrade = oldGrade * 0.93f + grade * 0.07f; scoreProp.SetValue(CurrentPerformanceStat, newGrade); if (newGrade > GameConstants.playFetusPassThreshold) { //this may or may not work depending on which update gets called first SkipSingle(); scoreProp.SetValue(CurrentPerformanceStat, 0); mManager.mMusicManager.play_sound_effect("cutGood"); TimeRemaining = 0; } } } else if (NGM.CurrentCharacterIndex == CharacterIndex.sOneHundred) { mAstronaut.update_astro(); } else { CurrentPerformanceStat.update_score(PercentTimeCompletion, 0.5f); } //warning if (NGM.CurrentPoseAnimation != null && NGM.CurrentCharacterIndex.LevelIndex != 0) { float perc = 3f / GameConstants.playDefaultPlayTime; if (PercentTimeCompletion > GameConstants.warningMinTime && CurrentPerformanceStat.last_score(perc) / (perc) < 0.2f) { mInterfaceManager.enable_warning_text(true); } else { mInterfaceManager.enable_warning_text(false); } } //make sure music is finished too! //if((TimeRemaining <= 0 && !mManager.mMusicManager.IsMusicSourcePlaying) || TimeRemaining < -4) //but don't wait too long if (TimeRemaining <= 0) { CurrentPerformanceStat.Finished = true; mInterfaceManager.enable_warning_text(false); transition_to_CUTSCENE(); //if we don't want fetus to have a cutscene use this //if(CurrentPerformanceStat.Character.Index != 0) // transition_to_CUTSCENE(); //else transition_to_CHOICE(); //handle astronaut //note maybe we want to use physics for cutscene as well in which case we should move this into transition_to_CUTSCENE if (NGM.CurrentCharacterIndex == CharacterIndex.sOneHundred) { mAstronaut.finish_astro(); } return; } //if we don't want the music to play during the cutscenes and whatont... //if(GS != NormalPlayGameState.PLAY) // mManager.mMusicManager.fade_out(); //early death bool die = false; die |= KeyMan.GetKeyDown("Die"); //if (NGM.CurrentPoseAnimation != null && mManager.mZigManager.has_user() && NGM.CurrentCharacterIndex.LevelIndex != 0) if (NGM.CurrentPoseAnimation != null && mManager.mZigManager.is_reader_connected() == 2 && NGM.CurrentCharacterIndex.LevelIndex != 0) { if (PercentTimeCompletion > GameConstants.deathMinTime) { float perc = GameConstants.deathRequiredTime / GameConstants.playDefaultPlayTime; if (CurrentPerformanceStat.last_score(perc) / perc < GameConstants.deathPerformanceThreshold) { die |= true; } } } float perc2 = GameConstants.deathRequiredTime / GameConstants.playDefaultPlayTime; //ManagerManager.Manager.mDebugString = CurrentPerformanceStat.last_score(perc2).ToString("#.##") + " " + (CurrentPerformanceStat.last_score(perc2) / perc2).ToString("#.##") + " " + (PercentTimeCompletion).ToString("#.##"); if (die && NGM.CurrentCharacterIndex != CharacterIndex.sOneHundred) //can't die as astronaut, even if we want to { if (NGM.CurrentCharacterIndex != CharacterIndex.sFetus) //this only happens if we try and force die on fetus { mGiftManager.capture_player(); } CurrentPerformanceStat.Finished = true; mInterfaceManager.enable_warning_text(false); transition_to_DEATH(); } }
//returns choice public int update(SetChoiceInterface aInterface) { if (mChoicePoses == null || mChoicePoses.Length == 0) { throw new UnityException("problem with choice poses"); } string output = ""; int minIndex = 0; float minGrade = 99999; for (int i = 0; i < mChoicePoses.Length; i++) { if (mChoicePoses[i] != null) { float grade = 9999999; //important that there are more 9s here than above! if (CurrentPose != null && mChoicePoses[i] != null) { grade = ProGrading.grade_pose(CurrentPose, mChoicePoses[i], false); } if (grade < minGrade) { minGrade = grade; minIndex = i; } output += grade.ToString("##.###") + " "; } } //ManagerManager.Manager.mDebugString = minGrade.ToString("##.###") + " " + output; //Debug.Log(output); if (minGrade > SELECTION_THRESHOLD) { NextContendingChoice = -1; } else { NextContendingChoice = minIndex; } float growthRate = CHOOSING_PERCENTAGE_GROWTH_RATE; //hack choice testing if (KeyMan.GetKey("Choice1")) { NextContendingChoice = 0; growthRate = 1; } else if (KeyMan.GetKey("Choice2")) { NextContendingChoice = 1; growthRate = 1; } else if (KeyMan.GetKey("Choice3")) { NextContendingChoice = 2; growthRate = 1; } else if (KeyMan.GetKey("Choice4")) { NextContendingChoice = 3; growthRate = 1; } //else if(Input.GetKey(KeyCode.Alpha4)) // NextContendingChoice = 3; if (NextContendingChoice != -1 && LastContendingChoice != NextContendingChoice) { ManagerManager.Manager.mMusicManager.play_sound_effect("choiceBlip"); } aInterface.set_choice(NextContendingChoice); for (int i = 0; i < mChoicePoses.Length; i++) { if (NextContendingChoice == i) { ChoosingPercentages[i] = Mathf.Clamp01(ChoosingPercentages[i] + growthRate * Time.deltaTime); } else { ChoosingPercentages[i] = Mathf.Clamp01(ChoosingPercentages[i] - CHOOSING_PERCENTAGE_DECLINE_RATE * Time.deltaTime); } aInterface.set_choice_percentages(i, ChoosingPercentages[i]); if (ChoosingPercentages[i] == 1) { for (int j = 0; j < ChoosingPercentages.Length; j++) { ChoosingPercentages[j] = 0; } LastContendingChoice = -1; ManagerManager.Manager.mMusicManager.play_sound_effect("choiceMade"); return(NextContendingChoice); } } LastContendingChoice = NextContendingChoice; return(-1); }