示例#1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            playersArrived++;
            if (PhotonNetwork.IsConnected)
            {
                if (other.GetComponent <PhotonView>().IsMine)
                {
                    myPlayer = other.gameObject;
                    myPlayer.GetComponent <PlayerControllerMap>().SetTimer(0, false);
                }
            }
            else
            {
                myPlayer = other.gameObject;
                myPlayer.GetComponent <PlayerControllerMap>().SetTimer(0, false);
            }
            players.Add(other.gameObject);
        }

        if (playersArrived >= playersNumber)
        {
            StartCoroutine(controlledDoor.OpenDoorsWithDelay(0.5f));

            PlayerInput playerInput = myPlayer.GetComponent <PlayerInput>();
            playerInput._canMove = false;
            playerInput._isFinal = true;
            playerInput.Movement = new Vector2(0, 0);
            checkpointReached    = new bool[playersNumber];
            movingPlayer         = true;
        }
    }
 public void updateResultConsole(int value, PlayerControllerMap playerControllerMap)
 {
     if (hasFinished)
     {
         return;
     }
     _numberOfIteration++;
     _resultConsole.updateValue(value);
     if (_resultConsole.Result == _finalValue && numberOfSteps == _numberOfIteration)
     {
         FindObjectOfType <AudioManager>().Play("OperationRight");
         StartCoroutine(doors.OpenDoorsWithDelay(0.5f));
         confirmCounterForUser();
     }
     else if (_numberOfIteration == numberOfSteps)
     {
         FindObjectOfType <AudioManager>().Play("OperationWrong");
         playerControllerMap.IncrementTimer(-timePenalityInSeconds);
         _resultConsole.reset(_startingValue);
         foreach (ButtonConsole buttonConsole in _buttonConsoles)
         {
             buttonConsole.Button.resetPressedStatus();
         }
         StartCoroutine(resetCounterForUser());
     }
     else
     {
         FindObjectOfType <AudioManager>().Play("OperationNorm");
         updateCounterForUser(_numberOfIteration - 1);
     }
 }
    public void ButtonPressed(int index)
    {
        if (!disabled)
        {
            pressed.Add(index);
            if (isInMaze)
            {
                pressedButtonsGUI.UpdatePressedColors(buttonColors[index]);
            }

            if (pressed.Count() >= numberOfActiveButtons)
            {
                if (orderedButtons.SequenceEqual(pressed))
                {
                    StartCoroutine(controlledDoors.OpenDoorsWithDelay(0.5f));
                    disabled = true;
                    if (isInMaze)
                    {
                        FindObjectOfType <AudioManager>().Play("MazeCubeRight");
                    }
                    else
                    {
                        FindObjectOfType <AudioManager>().Play("CubeRight");
                    }
                }
                else
                {
                    if (isInMaze)
                    {
                        FindObjectOfType <AudioManager>().Play("MazeCubeWrong");
                    }
                    else
                    {
                        FindObjectOfType <AudioManager>().Play("CubeWrong");
                    }
                    ResetButtons();
                }
            }
            else
            {
                if (isInMaze)
                {
                    if (pressed.Count == 1)
                    {
                        FindObjectOfType <AudioManager>().Play("MazeCubeNorm1");
                    }
                    else if (pressed.Count == 2)
                    {
                        FindObjectOfType <AudioManager>().Play("MazeCubeNorm2");
                    }
                }
                else
                {
                    FindObjectOfType <AudioManager>().Play("CubeNorm");
                }
            }
        }
    }
示例#4
0
 public void VerifyCombination()
 {
     ItemSlot[] slots = combinationPanel.Slots;
     for (int i = 0; i < slots.Length; i++)
     {
         if (slots[i].SlotImage.Image.enabled == false || slots[i].SlotImage.MyCollectable.ID != selectedNumbers[i])
         {
             StartCoroutine(ChangePanelColor(Color.red));
             combinationPanel.TriggerWrongCombination();
             FindObjectOfType <AudioManager>().Play("RuneWrong");
             return;
         }
     }
     StartCoroutine(ChangePanelColor(Color.green));
     FindObjectOfType <AudioManager>().Play("RuneRight");
     StartCoroutine(exitDoor.OpenDoorsWithDelay(0.5f));
     combinationPanel.ClosePanel(0.5f);
 }
示例#5
0
    public void VerifyCombination()
    {
        if (combinationPanel.Slots[0].GetIsFree())
        {
            StartCoroutine(ChangePanelColor(Color.red));
            combinationPanel.TriggerWrongCombination();
            return;
        }
        if (combinationPanel.Slots[0].SlotImage.MyCollectable.ID != winnerLockerIndex)
        {
            combinationPanel.Slots[0].RemoveImage();
            StartCoroutine(ChangePanelColor(Color.red));
            combinationPanel.TriggerWrongCombination();
            FindObjectOfType <AudioManager>().Play("TotemWrong");
            return;
        }

        StartCoroutine(ChangePanelColor(Color.green));
        FindObjectOfType <AudioManager>().Play("TotemConfirm");
        StartCoroutine(exitDoor.OpenDoorsWithDelay(0.5f));
        combinationPanel.ClosePanel(0.5f);
    }