void Start()
 {
     disarmButton.OnInteract += delegate {
         audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
         isPressedDisarm = true;
         return(false);
     };
     disarmButton.OnInteractEnded += delegate
     {
         disarmButton.AddInteractionPunch(1f);
         audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
         isPressedDisarm = false;
         if (isSolved)
         {
             if (!hasDisarmed)
             {
                 Debug.LogFormat("[Singularity Button #{0}]: Module disarmed.", curmodID);
                 string[] possibleDisarmMessages = { "MODULE\nDISARMED", "CHECK\nYOUR\nMODULES" };
                 textDisarm.text = possibleDisarmMessages.PickRandom();
                 disarmBacking.material.color = Color.green * 0.5f;
             }
             modSelf.HandlePass();
             hasDisarmed = true;
         }
     };
     buttonFront.OnInteract += delegate
     {
         audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
         if (!isSolved && hasActivated && !singularityButtonInfo.canDisarm)
         {
             singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
         }
         isPressedMain = true;
         onHoldState   = hasActivated;
         return(false);
     };
     buttonFront.OnInteractEnded += delegate
     {
         audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonRelease, transform);
         buttonFront.AddInteractionPunch();
         if (!isSolved && hasActivated && onHoldState && !singularityButtonInfo.canDisarm)
         {
             singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
             singularityButtonInfo.HandleButtonRelease();
         }
         isPressedMain = false;
     };
     modSelf.OnActivate += delegate
     {
         textDisarm.text = "";
         // Setup Global Interaction
         KMBomb bombAlone = entireModule.GetComponentInParent <KMBomb>();            // Get the bomb that the module is attached on. Required for intergration due to modified value.
         //Required for Multiple Bombs stable interaction in case of different bomb seeds.
         if (!groupedSingularityButtons.ContainsKey(bombAlone))
         {
             groupedSingularityButtons[bombAlone] = new SingularityButtonInfo();
         }
         singularityButtonInfo = groupedSingularityButtons[bombAlone];
         singularityButtonInfo.singularButtons.Add(this);
         // Start Main Handling
         //AddOthersModulesOntoList();
         StartCoroutine(HandleGlobalModule());
     };
     bombInfo.OnBombExploded += delegate
     {
         singularityButtonInfo.StopAll();
         StopAllCoroutines();
     };
     lightStrike.range *= modSelf.transform.lossyScale.x;
     textDisarm.text    = "";
     hasActivated       = true;
 }
Ejemplo n.º 2
0
    void Start()
    {
        disarmButton.OnInteract += delegate {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            isPressedDisarm = true;
            return(false);
        };
        disarmButton.OnInteractEnded += delegate
        {
            disarmButton.AddInteractionPunch(1f);
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
            isPressedDisarm = false;
            if (isSolved)
            {
                modSelf.HandlePass();
                hasDisarmed = true;
            }
        };
        buttonFront.OnInteract += delegate
        {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonPress, transform);
            if (!isSolved && hasActivated)
            {
                singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
            }
            isPressedMain = true;
            onHoldState   = hasActivated;
            return(false);
        };
        buttonFront.OnInteractEnded += delegate
        {
            audioSelf.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.BigButtonRelease, transform);
            buttonFront.AddInteractionPunch();
            if (!isSolved && hasActivated && onHoldState)
            {
                singularityButtonInfo.HandleInteraction(this, (int)bombInfo.GetTime());
            }
            isPressedMain = false;
        };
        modSelf.OnActivate += delegate
        {
            // Setup Global Interaction
            KMBomb bombAlone = entireModule.GetComponentInParent <KMBomb>();            // Get the bomb that the module is attached on. Required for intergration due to modified value.
            //Required for Multiple Bombs stable interaction in case of different bomb seeds.

            if (!groupedSingularityButtons.ContainsKey(bombAlone))
            {
                groupedSingularityButtons[bombAlone] = new SingularityButtonInfo();
            }
            singularityButtonInfo = groupedSingularityButtons[bombAlone];
            singularityButtonInfo.singularButtons.Add(this);
            colorblindDetected = colorblindMode.ColorblindModeActive;
            // Start Main Handling
            //AddOthersModulesOntoList();
            StartCoroutine(HandleGlobalModule());
            hasActivated = true;
        };
        bombInfo.OnBombExploded += delegate
        {
            singularityButtonInfo.StopAll();
        };
    }