Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        float scalar = transform.lossyScale.x;// Account for scale factor for this module being smaller, check KTANE official discord in #modding

        foreach (Light onelight in lights)
        {
            onelight.range *= scalar;
        }
        animLight.range *= scalar;
        TileAnim.SetActive(false);
        Generate4x4Puzzle();
        for (int selidx = 0; selidx < tileSelectables.Length; selidx++)
        {
            int y = selidx;
            tileSelectables[selidx].OnInteract += delegate
            {
                tileSelectables[y].AddInteractionPunch();
                kMAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
                if (!solved)
                {
                    inputsOverall.Add(y);
                }
                return(false);
            };
        }
        bombInfo.OnBombExploded += delegate
        {
            if (solved || isGenerating)
            {
                return;
            }

            string debugMoves = "";
            foreach (int inIdx in inputsOverall)
            {
                debugMoves += debugCoordCol[inIdx % 4] + debugCoordRow[inIdx / 4 % 4] + " ";
            }
            debugMoves.Trim();
            Debug.LogFormat("[15 Mystic Lights #{0}]: The following moves used on the given board when the bomb blew were {1}", curmodid, debugMoves);
        };

        moduleSelf.OnActivate += delegate {
            if (TwitchPlaysActive)
            {
                StatusLight.SetActive(true);
            }
            else
            {
                StatusLight.SetActive(false);
            }
        };
        //StatusLight.SetActive(false);
    }
    IEnumerator PlaySolveAnim(int ycor, int xcor)
    {
        playingAnim = true;
        kMAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.WireSequenceMechanism, transform);
        Vector3 pointTL = AnimPointTL.transform.localPosition;
        Vector3 pointBR = AnimPointBR.transform.localPosition;
        Vector3 pointD  = AnimPointD.transform.localPosition;
        //Vector3 LastStatLightScale = new Vector3(StatusLight.transform.localScale.x, StatusLight.transform.localScale.y, StatusLight.transform.localScale.z);
        bool lgtSteSgl = (bool)GetFirstNonNullTileState();

        for (int idx = 0; idx < textMeshes.Length; idx++)
        {
            textMeshes[idx].gameObject.SetActive(false);
        }
        float localX = pointBR.x * xcor / 3f + pointTL.x * (3 - xcor) / 3f;
        float localY = pointBR.y * ycor / 3f + pointTL.y * (3 - ycor) / 3f;

        for (float x = 1; x >= 0; x -= Time.deltaTime)
        {
            float localZ = pointD.z * x;
            TileAnim.SetActive(true);
            StatusLight.SetActive(true);
            TileAnim.transform.localPosition    = new Vector3(localX, localY, localZ);
            StatusLight.transform.localPosition = new Vector3(localX, localY, localZ + .005f);

            AnimRenderer.material = lgtSteSgl ? materials[0] : materials[1];
            animLight.color       = lgtSteSgl ? Color.yellow : Color.blue;
            animLight.enabled     = true;
            yield return(null);
        }
        StatusLight.transform.localPosition = new Vector3(localX, localY, .005f);
        TileAnim.SetActive(false);
        int tileIndex = xcor + 4 * ycor;

        tiles[tileIndex].SetActive(true);
        meshRenderers[tileIndex].material = lgtSteSgl ? materials[0] : materials[1];
        lights[tileIndex].enabled         = true;
        lights[tileIndex].color           = lgtSteSgl ? Color.yellow : Color.blue;
        moduleSelf.HandlePass();
        yield return(null);
    }
Ejemplo n.º 3
0
    IEnumerator PlaySolveAnim(int ycor, int xcor)
    {
        playingAnim = true;
        kMAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.WireSequenceMechanism, transform);
        Vector3 pointTL = AnimPointTL.transform.localPosition;
        Vector3 pointBR = AnimPointBR.transform.localPosition;
        Vector3 pointD  = AnimPointD.transform.localPosition;
        //Vector3 LastStatLightScale = new Vector3(StatusLight.transform.localScale.x, StatusLight.transform.localScale.y, StatusLight.transform.localScale.z);
        bool lgtSteSgl = (bool)GetFirstNonNullTileState();

        for (int idx = 0; idx < textMeshes.Length; idx++)
        {
            textMeshes[idx].gameObject.SetActive(false);
        }
        for (int x = animDelay * 2; x >= 0; x--)
        {
            float localX = 0;
            float localY = 0;
            float localZ = 0;
            for (int p = 0; p < 3; p++)
            {
                // Grab end points of the animation
                if (xcor > p)
                {
                    localX += pointBR.x;
                }
                else
                {
                    localX += pointTL.x;
                }
                if (ycor > p)
                {
                    localY += pointBR.y;
                }
                else
                {
                    localY += pointTL.y;
                }
            }
            for (int y = 0; y < x; y++)
            {
                localZ += pointD.z;
            }
            localZ /= animDelay * 2;
            localX /= 3;
            localY /= 3;
            TileAnim.SetActive(true);
            StatusLight.SetActive(true);
            TileAnim.transform.localPosition    = new Vector3(localX, localY, localZ);
            StatusLight.transform.localPosition = new Vector3(localX, localY, localZ + .005f);

            AnimRenderer.material = lgtSteSgl ? materials[0] : materials[1];
            animLight.color       = lgtSteSgl ? Color.yellow : Color.blue;
            animLight.enabled     = true;
            yield return(new WaitForSeconds(0));
        }
        TileAnim.SetActive(false);
        int tileIndex = xcor + 4 * ycor;

        tiles[tileIndex].SetActive(true);
        meshRenderers[tileIndex].material = lgtSteSgl ? materials[0] : materials[1];
        lights[tileIndex].enabled         = true;
        lights[tileIndex].color           = lgtSteSgl ? Color.yellow : Color.blue;
        moduleSelf.HandlePass();
        yield return(null);
    }