Example #1
0
    // Use this for initialization
    void Start()
    {
        _id       = idCounter++;
        speciesId = UnityEngine.Random.Range(0, CroppedMats.Length - 1);
        Debug.LogFormat("[Fursona #{0}] Selected species: {1}", _id, NAMES[speciesId]);
        CroppedRenderer.material   = CroppedMats[speciesId];
        HeadRenderer.material      = HeadMats[speciesId];
        EyesRenderer.material      = EyesMats[speciesId];
        FleshRenderer.material     = FleshMats[speciesId];
        PrimaryRenderer.material   = PrimaryMats[speciesId];
        SecondaryRenderer.material = SecondaryMats[speciesId];
        TertiaryRenderer.material  = TertiaryMats[speciesId];
        UpdateColors();
        PhysicalSlider[] Sliders = new PhysicalSlider[] { A1, A2, A3, B1, B2, B3, C1, C2, C3, D1, D2, D3, E1, E2, E3, F1, F2, F3 };
        foreach (PhysicalSlider Slider in Sliders)
        {
            Slider.OnUpdate += UpdateColors;
        }

        KMBombInfo info = GetComponent <KMBombInfo>();
        int        ui   = KMBombInfoExtensions.GetOffIndicators(info).Count();
        int        li   = KMBombInfoExtensions.GetOnIndicators(info).Count();
        int        b    = KMBombInfoExtensions.GetBatteryCount(info);
        int        bh   = KMBombInfoExtensions.GetBatteryHolderCount(info);
        int        p    = KMBombInfoExtensions.GetPortCount(info);
        int        ep   = KMBombInfoExtensions.GetPortPlates(info).Count(sa => sa.Length == 0);
        int        s3   = int.Parse(KMBombInfoExtensions.GetSerialNumber(info)[2].ToString());
        int        s6   = int.Parse(KMBombInfoExtensions.GetSerialNumber(info)[5].ToString());
        int        pp   = KMBombInfoExtensions.GetPortPlates(info).Count();
        int        sl   = KMBombInfoExtensions.GetSerialNumberLetters(info).Count();
        int        sn   = KMBombInfoExtensions.GetSerialNumberNumbers(info).Count();
        int        m    = info.GetModuleIDs().Count;

        int R = -1, G = -1, B = -1, C = -1, M = -1, Y = -1;

        switch (speciesId)
        {
        case 0:
            R = li;
            G = ui;
            B = b;
            C = bh;
            M = p;
            Y = ep;
            break;

        case 1:
            R = s3;
            G = s6;
            B = pp;
            C = sl;
            M = sn;
            Y = m;
            break;

        case 2:
            R = ep;
            G = m;
            B = p;
            C = sn;
            M = bh;
            Y = sl;
            break;

        case 3:
            R = sl;
            G = s3;
            B = bh;
            C = li;
            M = sn;
            Y = s6;
            break;

        case 4:
            R = p;
            G = ui;
            B = m;
            C = pp;
            M = ep;
            Y = b;
            break;

        case 5:
            R = s6;
            G = b;
            B = sn;
            C = ep;
            M = li;
            Y = pp;
            break;

        case 6:
            R = bh;
            G = m;
            B = s3;
            C = ui;
            M = sl;
            Y = p;
            break;

        case 7:
            R = pp;
            G = p;
            B = li;
            C = sl;
            M = ep;
            Y = ui;
            break;

        case 8:
            R = sn;
            G = s3;
            B = b;
            C = m;
            M = s6;
            Y = bh;
            break;

        case 9:
            R = ui;
            G = bh;
            B = ep;
            C = s6;
            M = sl;
            Y = m;
            break;

        case 10:
            R = li;
            G = b;
            B = p;
            C = s3;
            M = pp;
            Y = sn;
            break;

        default:
            break;
        }

        int maxId = 0;

        int[] vals = new int[] { R, G, B, C, M, Y };
        for (int i = 1; i < 6; i++)
        {
            if (vals[i] >= vals[maxId])
            {
                maxId = i;
            }
        }

        TargetEyeColor = maxId;
        Debug.LogFormat("[Fursona #{0}] Eye color: {1}; Head color: {2}", _id, COLORNAMES[maxId], COLORNAMES[(maxId + 3) % 6]);
    }
Example #2
0
    void Init()
    {
        for (int i = 0; i < formulaShow.Length; i++)
        {
            formulaShow[i] = Random.value < .5 ? true : false;
        }
        AmountGroup.SetActive(false);

        readChar       = (char)Random.Range(65, 91);
        readColor      = Random.Range(0, 8);
        ReadText.text  = "" + readChar;
        ReadText.color = readColors[readColor];
        DebugLog("Displayed letter is " + readColorLogs[readColor] + " " + readChar);

        int serialSum   = KMBombInfoExtensions.GetSerialNumberNumbers(Info).Sum();
        int reactionNum = readChar - 65;

        if (reactionNum > serialSum)
        {
            reactionNum -= serialSum;
        }
        reactionNum   %= 8;
        chosenReaction = reactions[reactionNum];

        productAmount  = readColorValues[readColor];
        productAmount += KMBombInfoExtensions.GetOffIndicators(Info).Count();
        int portCount = KMBombInfoExtensions.GetPortCount(Info);

        if (portCount > 1)
        {
            productAmount *= portCount;
        }
        productAmount %= 50;
        if (productAmount == 0)
        {
            productAmount = 50;
        }
        productAmount *= 10;
        productAmount -= KMBombInfoExtensions.GetOnIndicators(Info).Count();
        if (productAmount <= 0)
        {
            DebugLog("That's a lot of lit indicators. I guess you deserve this.");
            SolveModule();
            return;
        }

        if (chosenReaction.Solvent == null)
        {
            solventAdded = 100.000m;
        }

        DebugLog("Reaction: " + chosenReaction.Product.GetLogString());
        DebugLog("Product amount: " + productAmount + "g");
        DebugLog("Solvent: " + (chosenReaction.Solvent == null ? "None" : chosenReaction.Solvent.GetLogString()));
        DebugLog("Required reagents:");
        foreach (Compound r in chosenReaction.Reagents)
        {
            DebugLog(" - " + chosenReaction.GetReagentAmount(r, productAmount) + r.GetUnit() + " of " + r.GetLogString());
        }
        DebugLog("----------------------------------");
    }