Пример #1
0
    public void OnClickOption(int index)
    {
        pubnubHelper.Publish("Answer:" + index);
        if (cozmoQuestionIndex == 10)
        {
            if (index == 1)
            {
                cozmoQuestions[16].cozmoDialog = cozmoQuestions [16].cozmoDialog + "Here, something to remember me by.";
                cozmoQuestions[17].cozmoDialog = cozmoQuestions [17].cozmoDialog + "Here, something to remember me by.";
            }
            else
            {
                cozmoQuestions[16].cozmoDialog = cozmoQuestions [16].cozmoDialog + "Here, you can see what you’re missing out on.";
                cozmoQuestions[17].cozmoDialog = cozmoQuestions [17].cozmoDialog + "Here, something to remember me by.";
            }
        }

        LeanTween.cancel(guestPanel);
        AudioManager.Main.PlayNewSound("click");
        ResetPlayerPanel(0.1f);
        ResetCozmoBubble();
        if (this.photosPanel.activeSelf)
        {
            ResetPhotosPanel();
        }

        if (this.flowersPanel.activeSelf)
        {
            ResetFlowersPanel();
        }

        if (this.cubePanel.activeSelf)
        {
            ResetCubePanel();
        }
    }
Пример #2
0
    public void OnSlotClick(int btnIndex)
    {
        if (!isPlayerTurn)
        {
            return;
        }

        //print ("OnSlotClick: " + btnIndex);
        if (cozmoSlots.Contains(btnIndex))
        {
            print("Wrong Slot: Cozmo's slot is picked!");
            PlaySound(wrong_sound);
            return;
        }

        if (gameState == 0)
        {
            if (flashList.Contains(btnIndex))
            {
                StopFlash(btnIndex, PLAYER_COLOR);
                flashList.Remove(btnIndex);
                pubnubHelper.Publish("PlayerReady:" + btnIndex);
                PlaySound(snap_sound);
            }
            if (flashList.Count == 0)
            {
                gameState    = 1;
                isPlayerTurn = false;
                pubnubHelper.Publish(START_GAME);
            }
        }
        else if (gameState == 1)
        {
            //if flash list is empty - select slot and flash
            if (flashList.Count == 0)
            {
                if (selectedBtnList.Contains(btnIndex) && isValidSlotSelection(btnIndex))
                {
                    StartFlash(btnIndex, DEFAULT_COLOR);
                    flashList.Add(btnIndex);
                    PlaySound(unsnap_sound);
                }
                else
                {
                    print("select green slot to move first");
                    PlaySound(wrong_sound);
                    Color oriColor = slots [btnIndex].GetComponent <Image> ().color;
                    StartFlash(btnIndex, Color.red, 0.2f);
                    LeanTween.delayedCall(0.5f, () => {
                        StopFlash(btnIndex, oriColor);
                    });
                }
            }
            else if (flashList.Count == 1)
            {
                //if one slot is already selected to mvoe
                if (flashList.Contains(btnIndex))
                {
                    //deselect flash on currently flashing slot
                    StopFlash(btnIndex, PLAYER_COLOR);
                    flashList.Remove(btnIndex);
                }
                else if (!selectedBtnList.Contains(btnIndex))
                {
                    //select new slot and stop flashing old slot
                    int prevFlashingIndex = flashList [0];
                    flashList.Remove(prevFlashingIndex);
                    StopFlash(prevFlashingIndex, DEFAULT_COLOR);
                    ChangePlayerSlot(btnIndex, true, PLAYER_COLOR);
                    ChangePlayerSlot(prevFlashingIndex, false, DEFAULT_COLOR);

                    //player move complete - send cozmo message now
                    pubnubHelper.Publish("PlayerMove:" + prevFlashingIndex + "," + btnIndex);
                    isPlayerTurn = false;
                    PlaySound(snap_sound);
                }
            }
        }
    }