diff options
| author | yum <yum.food.vr@gmail.com> | 2022-09-29 15:09:29 -0700 |
|---|---|---|
| committer | yum <yumfood@airmail.cc> | 2022-09-29 15:09:29 -0700 |
| commit | 963f8aecb44a6cff83a75a60deec102562d79ff1 (patch) | |
| tree | 86d1ad21a12ac732c7043d03416eab2b111daf33 /SetLetters.cs | |
| parent | 6aecadd5f73fc92992435b2d210a55a01280de95 (diff) | |
delete SetLetters.cs
Doesn't work in game.
Also change # of characters per slot to 80, down from 128.
Also realize that VRChat supports 256 BITS of parameter, not 256 BYTES.
Next design idea:
* 3 8-bit parameters: letter, row, col
* 1 boolean parameter: active
* one animation for each slot/letter combo, as usual
* one fx layer like this:
if !active:
do nothing
if row == 0:
if col == 0:
if letter == 0:
play row00_col00_letter00 animation
* because write defaults are off, we should be able to "save" letters
by simply setting active = false
* thus we don't need to simultaneously address the entire board, saving
memory
Diffstat (limited to 'SetLetters.cs')
| -rw-r--r-- | SetLetters.cs | 191 |
1 files changed, 0 insertions, 191 deletions
diff --git a/SetLetters.cs b/SetLetters.cs deleted file mode 100644 index 558e3c2..0000000 --- a/SetLetters.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -// Expands a list of 4-byte parameters into a longer list of (effectively) -// 1-byte parameters. The 1-byte parameters are easier to use in an animation -// layer, since we can write conditions for them. -[SharedBetweenAnimators] -public class SetLetters : StateMachineBehaviour -{ - Dictionary<string, int> letters_; - List<string> cell_parameters_; - List<string> group_parameters_; - - int GetLetterFromGroup(int g, int which) - { - return (((g & (0x000000FF << (which * 8))) >> (which * 8)) & 0x000000FF); - } - - // This function is called in 2 contexts: - // 1. animator.parameters contains everything we need. Updating params is not - // reflected in emulator. - // 2. animator.parameters contains nothing we need. Updating params is - // reflected in emulator. - override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) - { - if (letters_ == null) { - letters_ = new Dictionary<string, int>(); - } - - // I don't know why or how but Unity fucking refuses to save this variable, - // so reinitialize it every time, YOLO. - cell_parameters_ = new List<string> { - "_Letter_Row00_Col00", - "_Letter_Row00_Col01", - "_Letter_Row00_Col02", - "_Letter_Row00_Col03", - "_Letter_Row00_Col04", - "_Letter_Row00_Col05", - "_Letter_Row00_Col06", - "_Letter_Row00_Col07", - "_Letter_Row00_Col08", - "_Letter_Row00_Col09", - "_Letter_Row00_Col10", - "_Letter_Row00_Col11", - "_Letter_Row00_Col12", - "_Letter_Row00_Col13", - "_Letter_Row01_Col00", - "_Letter_Row01_Col01", - "_Letter_Row01_Col02", - "_Letter_Row01_Col03", - "_Letter_Row01_Col04", - "_Letter_Row01_Col05", - "_Letter_Row01_Col06", - "_Letter_Row01_Col07", - "_Letter_Row01_Col08", - "_Letter_Row01_Col09", - "_Letter_Row01_Col10", - "_Letter_Row01_Col11", - "_Letter_Row01_Col12", - "_Letter_Row01_Col13", - "_Letter_Row02_Col00", - "_Letter_Row02_Col01", - "_Letter_Row02_Col02", - "_Letter_Row02_Col03", - "_Letter_Row02_Col04", - "_Letter_Row02_Col05", - "_Letter_Row02_Col06", - "_Letter_Row02_Col07", - "_Letter_Row02_Col08", - "_Letter_Row02_Col09", - "_Letter_Row02_Col10", - "_Letter_Row02_Col11", - "_Letter_Row02_Col12", - "_Letter_Row02_Col13", - "_Letter_Row03_Col00", - "_Letter_Row03_Col01", - "_Letter_Row03_Col02", - "_Letter_Row03_Col03", - "_Letter_Row03_Col04", - "_Letter_Row03_Col05", - "_Letter_Row03_Col06", - "_Letter_Row03_Col07", - "_Letter_Row03_Col08", - "_Letter_Row03_Col09", - "_Letter_Row03_Col10", - "_Letter_Row03_Col11", - "_Letter_Row03_Col12", - "_Letter_Row03_Col13", - "_Letter_Row04_Col00", - "_Letter_Row04_Col01", - "_Letter_Row04_Col02", - "_Letter_Row04_Col03", - "_Letter_Row04_Col04", - "_Letter_Row04_Col05", - "_Letter_Row04_Col06", - "_Letter_Row04_Col07", - "_Letter_Row04_Col08", - "_Letter_Row04_Col09", - "_Letter_Row04_Col10", - "_Letter_Row04_Col11", - "_Letter_Row04_Col12", - "_Letter_Row04_Col13", - "_Letter_Row05_Col00", - "_Letter_Row05_Col01", - "_Letter_Row05_Col02", - "_Letter_Row05_Col03", - "_Letter_Row05_Col04", - "_Letter_Row05_Col05", - "_Letter_Row05_Col06", - "_Letter_Row05_Col07", - "_Letter_Row05_Col08", - "_Letter_Row05_Col09", - "_Letter_Row05_Col10", - "_Letter_Row05_Col11", - "_Letter_Row05_Col12", - "_Letter_Row05_Col13", - }; - group_parameters_ = new List<string> { - "_Letter_Row00_Col00_03", - "_Letter_Row00_Col04_07", - "_Letter_Row00_Col08_11", - "_Letter_Row00_Col12_13", - "_Letter_Row01_Col00_03", - "_Letter_Row01_Col04_07", - "_Letter_Row01_Col08_11", - "_Letter_Row01_Col12_13", - "_Letter_Row02_Col00_03", - "_Letter_Row02_Col04_07", - "_Letter_Row02_Col08_11", - "_Letter_Row02_Col12_13", - "_Letter_Row03_Col00_03", - "_Letter_Row03_Col04_07", - "_Letter_Row03_Col08_11", - "_Letter_Row03_Col12_13", - "_Letter_Row04_Col00_03", - "_Letter_Row04_Col04_07", - "_Letter_Row04_Col08_11", - "_Letter_Row04_Col12_13", - "_Letter_Row05_Col00_03", - "_Letter_Row05_Col04_07", - "_Letter_Row05_Col08_11", - "_Letter_Row05_Col12_13", - }; - - bool got_match = false; - foreach (var param in animator.parameters) { - if (param.name == "_Letter_Row00_Col00_03") { - got_match = true; - break; - } - } - if (!got_match) { - if (!letters_.ContainsKey(cell_parameters_[0])) { - return; - } - foreach (var param in cell_parameters_) { - animator.SetInteger(param, letters_[param]); - } - - return; - } - - int cell_idx = 0; - for (int i = 0; i < group_parameters_.Count; i++) { - string group_param = group_parameters_[i]; - int g = animator.GetInteger(group_param); - - string cell_param = cell_parameters_[cell_idx]; - letters_[cell_param] = GetLetterFromGroup(g, 0); - cell_idx += 1; - - cell_param = cell_parameters_[cell_idx]; - letters_[cell_param] = GetLetterFromGroup(g, 1); - cell_idx += 1; - - // If we're on the last group of 4 in a row, we do not look at the cells, - // since there are only 14 cells in each row. - if (i % 4 != 3) { - cell_param = cell_parameters_[cell_idx]; - letters_[cell_param] = GetLetterFromGroup(g, 2); - cell_idx += 1; - - cell_param = cell_parameters_[cell_idx]; - letters_[cell_param] = GetLetterFromGroup(g, 3); - cell_idx += 1; - } - } - } -} |
