Ejemplo n.º 1
0
    private void Start()
    {
        Activated = 0;
        moduleId  = ++ModuleIdCounter;
        ModSettingsJSON.Get(this, out dimension, out rotation, out colorAssist, out isUsingBounce, out stretchToFit);

        ModuleSelectable.OnInteract          += Interact.Init(this, true, dimension - Info.GetSolvableModuleNames().Where(i => i == "The Octadecayotton").Count());
        SubModuleSelectable.OnInteract       += Interact.OnInteract(this, false, dimension - Info.GetSolvableModuleNames().Where(i => i == "The Octadecayotton").Count());
        SubModuleSelectable.OnHighlight      += () => SelectableRenderer.enabled = true;
        SubModuleSelectable.OnHighlightEnded += () => SelectableRenderer.enabled = false;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// The startup method for Init, which gets the module prepared to be interacted with.
    /// </summary>
    internal void Activate()
    {
        // Sets module ID.
        moduleId = ++moduleIdCounter;

        // Sets accessibility.
        ModSettingsJSON.Get(pho, out render.cruelMode, out vrMode, out streamDelay);
        UpdateCruel();

        // This allows TP to read this class.
        pho.TP.Activate(this);

        // Plays voice lines only if it is the last one initiated. Not checking this causes multiple sounds to stack up.
        pho.Info.OnBombSolved += () => { if (moduleId == moduleIdCounter)
                                         {
                                             pho.PlaySound("voice_bombdisarmed");
                                         }
        };
        pho.Info.OnBombExploded += () => { if (moduleId == moduleIdCounter)
                                           {
                                               pho.PlaySound("voice_gameover");
                                           }
        };

        pho.Number.OnInteract += select.NumberPress();
        pho.Color.OnInteract  += select.ColorPress();
        pho.Buttons.OnInteractArray(select.ButtonPress);

        // Initalize markers, and use OnDefocus.
        if (!vrMode)
        {
            pho.Color.OnDefocus += select.ColorRelease();
            pho.Markers.OnInteractArray(select.MarkerPress);
        }

        // Otherwise, remove markers and use OnInteractEnded.
        else
        {
            pho.Color.OnInteractEnded += select.ColorRelease();

            foreach (var highlight in pho.MarkerHighlightables)
            {
                highlight.transform.localPosition = new Vector3(highlight.transform.localPosition.x, -0.5f, highlight.transform.localPosition.z);
            }
        }
    }