private IEnumerator CheckState()
    {
        yield return(0);

        //Debug.Log("Checkstate");
        int  i            = 0;
        bool puzzleSolved = true;

        foreach (LeverAnimatedInteractable it in switches)
        {
            bool switchStateExpected = order[i];
            //Debug.Log("Switch: " + it.name + " : " + it.activated);
            //Debug.Log("Order: " + i + " : " + switchStateExpected);
            if (it.activated != switchStateExpected)
            {
                puzzleSolved = false;
            }
            i++;
        }
        if (puzzleSolved)
        {
            Debug.Log("PUZZLE SOLVED!");
            foreach (LeverAnimatedInteractable it in switches)
            {
                it.Disable();
            }
            triggerManager.ActivateReactors();
        }
        else
        {
            triggerManager.DeactivateReactors();
        }
    }
    IEnumerator StartEffect()
    {
        yield return(new WaitForSeconds(delayTextEffect));

        GuiController.GetInstance().ShowRandomFightText(durationTextEffect);
        triggerManagerActivateOnFight.ActivateReactors();
        StartCoroutine(EnableControlls());
    }
Пример #3
0
 public void OnTriggerEnter2D(Collider2D collider)
 {
     // react to trigger
     if (interactableLayer == (interactableLayer | (1 << collider.gameObject.layer)))
     {
         if (triggerManager != null)
         {
             triggerManager.ActivateReactors();
         }
     }
 }
Пример #4
0
 public override void Activate()
 {
     if (!permanentDisabled)
     {
         if (activated)
         {
             // deactivate
             bool changeState = true;
             if (triggerManager.HasReactors())
             {
                 changeState = triggerManager.DeactivateReactors();
             }
             if (changeState)
             {
                 ChangeState(OFF_ACTIVE);
                 activated = false;
             }
         }
         else
         {
             // activate
             bool startMoving = true;
             if (triggerManager.HasReactors())
             {
                 startMoving = triggerManager.ActivateReactors();
             }
             if (oneTimeUse)
             {
                 permanentDisabled = true;
                 actionArrow.SetActive(false);
             }
             if (startMoving)
             {
                 if (!permanentDisabled)
                 {
                     ChangeState(ON_ACTIVE);
                 }
                 else
                 {
                     ChangeState(ON);
                 }
                 activated = true;
             }
         }
     }
     actionFinished = true;
 }
 public override void Activate()
 {
     if (activated && !permanentDisabled)
     {
         // deactivate
         bool startMoving = true;
         if (triggerManager.HasReactors())
         {
             startMoving = triggerManager.DeactivateReactors();
         }
         if (startMoving)
         {
             sr.sprite = leverSpriteOff;
             activated = false;
         }
     }
     else
     {
         // activate
         if (!permanentDisabled)
         {
             bool startMoving = true;
             if (triggerManager.HasReactors())
             {
                 startMoving = triggerManager.ActivateReactors();
             }
             if (startMoving)
             {
                 sr.sprite = leverSpriteOn;
                 activated = true;
             }
             if (oneTimeUse)
             {
                 permanentDisabled = true;
                 actionArrow.SetActive(false);
             }
         }
     }
     actionFinished = true;
 }
    public override void Update()
    {
        if (!everythingFinished)
        {
            if (!fightStarted && !dialogueFinished && inDialogue)
            {
                // check if Dialogue finished
                if (!dialogue.inDialogue && !inFight)
                {
                    inFight = true;
                    StartCoroutine(StartEffect());
                    dialogueFinished = true;
                }
            }
            if (fightStarted && !fightFinished)
            {
                // check if boss is still alive
                if (!boss)
                {
                    StartCoroutine(BossKilledCoroutine());
                    fightFinished = true;
                }
            }

            if (fightFinished && showNewStats)
            {
                if (Input.anyKeyDown)
                {
                    PlayerController.GetInstance().InterruptState(AbstractState.ACTION.SWORD_UP);
                    newStatsTextbox.HideTextBox();
                    InputController.GetInstance().moveInputEnabled = true;
                    StartCoroutine(CameraFollow.GetInstance().MoveCameraBack(1F, transform.position));

                    triggerManagerActivateOnStart.DeactivateReactors();
                    triggerManagerActivateOnEnd.ActivateReactors();
                    everythingFinished = true;
                }
            }
        }
    }
 public override void Activate()
 {
     actionFinished = false;
     if (activated && !permanentDisabled)
     {
         // deactivate
         bool startMoving = triggerManager.DeactivateReactors();
         if (startMoving)
         {
             anim.SetBool("STOP", false);
             anim.SetBool("INTERACTABLE", false);
             anim.SetBool("START", true);
             activated = false;
         }
     }
     else
     {
         // activate
         if (!permanentDisabled)
         {
             bool startMoving = triggerManager.ActivateReactors();
             if (startMoving)
             {
                 anim.SetBool("STOP", false);
                 anim.SetBool("INTERACTABLE", false);
                 anim.SetBool("START", true);
                 activated = true;
             }
             if (oneTimeUse)
             {
                 permanentDisabled = true;
                 actionArrow.SetActive(false);
             }
         }
     }
 }
 public override void StartDialogue()
 {
     base.StartDialogue();
     triggerManagerActivateOnStart.ActivateReactors();
 }
Пример #9
0
    public IEnumerator ActivateTriggerManager()
    {
        yield return(new WaitForSeconds(waitTriggerTime));

        triggerManager.ActivateReactors();
    }