Esempio n. 1
0
    private void Start()
    {
        EventTrigger.Entry onPointerEnter = null;
        EventTrigger.Entry onPointerClick = null;

        for (int i = 0; i < eventTrigger.triggers.Count; i++)
        {
            if (eventTrigger.triggers[i].eventID == EventTriggerType.PointerEnter)
            {
                onPointerEnter = eventTrigger.triggers[i];
            }
            if (eventTrigger.triggers[i].eventID == EventTriggerType.PointerClick)
            {
                onPointerClick = eventTrigger.triggers[i];
            }
        }

        if (onPointerEnter == null)
        {
            onPointerEnter         = new EventTrigger.Entry();
            onPointerEnter.eventID = EventTriggerType.PointerEnter;

            eventTrigger.triggers.Add(onPointerEnter);
        }
        if (onPointerClick == null)
        {
            onPointerClick         = new EventTrigger.Entry();
            onPointerClick.eventID = EventTriggerType.PointerClick;

            eventTrigger.triggers.Add(onPointerClick);
        }

        onPointerEnter.callback.AddListener(delegate(BaseEventData e) { AudioSFXReferences.PlayButtonHighlight(); });
        onPointerClick.callback.AddListener(delegate(BaseEventData e) { AudioSFXReferences.PlayButtonClick(); });
    }
Esempio n. 2
0
    private void Update()
    {
        if (photonView.IsMine)
        {
            if (state == 0)
            {
                int logs = isPlayer1 ? GameCanvas.GetPlayer1Logs() : GameCanvas.GetPlayer2Logs();

                if (Input.GetKeyDown(keyCode) && (logs >= buildCosts[state]))
                {
                    //cehck for income and start dam
                    spamKeyBold.SetActive(true);
                    spamKeyMinigame.currentValue = 0.5f;
                    if (isPlayer1)
                    {
                        GameCanvas.SetPlayer1Logs(logs - buildCosts[state]);
                    }
                    else
                    {
                        GameCanvas.SetPlayer2Logs(logs - buildCosts[state]);
                    }

                    AudioSFXReferences.PlayPurchase();

                    state++;
                    buildCostText.text = buildCosts[state].ToString();
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, buildCosts[state], true);
                }
            }
        }
    }
Esempio n. 3
0
    private void DsiableCostObject(bool value, int costCount)
    {
        buildCostObject.SetActive(value);
        buildCostText.text = costCount.ToString();

        AudioSFXReferences.PlayBadPurchase();
    }
 private void Update()
 {
     if (PhotonNetwork.IsMasterClient && Input.GetKeyDown(buttonToPress))
     {
         _pressCount++;
         AudioSFXReferences.PlayButtonClick();
     }
 }
Esempio n. 5
0
    public void OnBought()
    {
        buttonPressObject.SetActive(false);
        holdKeyBold.SetActive(true);
        buildCostObject.SetActive(false);

        AudioSFXReferences.PlayBadPurchase();
    }
    public static void LeaveQueue()
    {
        titleScreen.enabled        = true;
        introductionCanvas.enabled = false;

        repeatingTileEnviroment.speed = repeatingTileEnviroment.startSpeed;

        AudioSFXReferences.PlayMainMenuMusic();
    }
    public static void EnterQueue()
    {
        titleScreen.enabled        = false;
        introductionCanvas.enabled = true;

        repeatingTileEnviroment.speed = repeatingTileEnviroment.queueSpeed;

        AudioSFXReferences.PlayQueueingMusic();
    }
Esempio n. 8
0
    private void OnFinish()
    {
        if (state == 3)
        {
            return;
        }
        else
        {
            int logs = isPlayer1 ? GameCanvas.GetPlayer1Logs() : GameCanvas.GetPlayer2Logs();

            if (logs >= buildCosts[state])
            {
                spamKeyMinigame.currentValue = 0.5f;

                if (isPlayer1)
                {
                    GameCanvas.SetPlayer1Logs(logs - buildCosts[state]);
                }
                else
                {
                    GameCanvas.SetPlayer2Logs(logs - buildCosts[state]);
                }

                state++;

                if (state == 3)
                {
                    buildCostObject.SetActive(false);
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, 0, false);

                    if (OnMaximum != null)
                    {
                        OnMaximum.Invoke();
                    }

                    if (isPlayer1)
                    {
                        LeftSide.AddNewDamBeaver();
                    }
                    else
                    {
                        RightSide.AddNewDamBeaver();
                    }
                }
                else
                {
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, buildCosts[state], true);
                }

                buildCostText.text = buildCosts[state].ToString();


                AudioSFXReferences.PlayPurchase();
            }
        }
    }
    public static void FoundQueue()
    {
        introductionCanvas.enabled = false;

        repeatingTileEnviroment.AlignWithEnviroment();

        CameraSceneMover.TravelToRiverEnviroment();

        AudioSFXReferences.PlayGameMusic();
    }
Esempio n. 10
0
    public void Player2WinsNet()
    {
        if (PhotonNetwork.IsMasterClient)
        {
            animator.SetTrigger("Lose");
            AudioSFXReferences.PlayLose();
        }
        else
        {
            animator.SetTrigger("Win");
            AudioSFXReferences.PlayWin();
        }

        finished = true;
    }
Esempio n. 11
0
    public static void Player2Wins()
    {
        if (PhotonNetwork.IsMasterClient)
        {
            animator.SetTrigger("Lose");
            AudioSFXReferences.PlayLose();
        }
        else
        {
            animator.SetTrigger("Win");
            AudioSFXReferences.PlayWin();
        }
        photonView.RPC("Player2WinsNet", RpcTarget.Others);

        finished = true;
    }
Esempio n. 12
0
    private void Update()
    {
        if (photonView.IsMine)
        {
            if (Input.GetKeyDown(keyCode) && !_isBought)
            {
                int fishs   = isPlayer1 ? GameCanvas.GetPlayer1Fish() : GameCanvas.GetPlayer2Fish();
                int beavers = isPlayer1 ? GameCanvas.GetPlayer1Beavers() : GameCanvas.GetPlayer2Beavers();

                if (Input.GetKeyDown(keyCode) && (fishs >= buildCost) && (beavers >= 1))
                {
                    if (isPlayer1)
                    {
                        GameCanvas.SetPlayer1Fish(fishs - buildCost);
                        GameCanvas.SetPlayer1Beavers(beavers - 1);
                    }
                    else
                    {
                        GameCanvas.SetPlayer2Fish(fishs - buildCost);
                        GameCanvas.SetPlayer2Beavers(beavers - 1);
                    }

                    holdKeyMinigame.currentHoldTime = 0.0f;
                    holdKeyBold.SetActive(true);
                    buildCostObject.SetActive(false);

                    photonView.RPC("OnBought", RpcTarget.Others);

                    _isBought = true;

                    AudioSFXReferences.PlayPurchase();

                    if (isPlayer1)
                    {
                        LeftSide.AddNewFishBeaver();
                    }
                    else
                    {
                        RightSide.AddNewFishBeaver();
                    }
                }
            }
        }
    }
Esempio n. 13
0
    private void OnFinish()
    {
        if (beaverCount == maxBeaverCount)
        {
            return;
        }
        else
        {
            int fish = isPlayer1 ? GameCanvas.GetPlayer1Fish() : GameCanvas.GetPlayer2Fish();

            if (fish >= buildCosts[beaverCount - 2])
            {
                spamKeyMinigame.currentValue = 0f;

                if (isPlayer1)
                {
                    GameCanvas.SetPlayer1Fish(fish - buildCosts[beaverCount - 2]);
                    GameCanvas.SetPlayer1Beavers(GameCanvas.GetPlayer1Beavers() + 1);
                }
                else
                {
                    GameCanvas.SetPlayer2Fish(fish - buildCosts[beaverCount - 2]);
                    GameCanvas.SetPlayer2Beavers(GameCanvas.GetPlayer2Beavers() + 1);
                }

                beaverCount++;

                AudioSFXReferences.PlayPurchase();

                if (beaverCount == maxBeaverCount)
                {
                    buildCostObject.SetActive(false);

                    photonView.RPC("DsiableCostObject", RpcTarget.Others, false, 0);
                }
                else
                {
                    buildCostText.text = buildCosts[beaverCount - 2].ToString();
                    photonView.RPC("DsiableCostObject", RpcTarget.Others, true, buildCosts[beaverCount - 2]);
                }
            }
        }
    }
    private void Awake()
    {
        bufferedAudioSources = new BufferedArray <BufferedAudioSource>(InstantiateBufferedAudioSource, BufferBufferedAudioSource);

        instance = this;

        mainCameraTransform = Camera.main.transform;

        backgroundMusicAudioSource = GameObject.Find("BackgroundMusicAudioSource").GetComponent <AudioSource>();

        buttonHighlightClip = _buttonHighlightClip;
        buttonClickClip     = _buttonClickClip;

        purchaseClip = _purchaseClip;
        winClip      = _winClip;
        loseClip     = _loseClip;

        mainMenuMusic = _mainMenuMusic;
        queueingMusic = _queueingMusic;
        gameMusic     = _gameMusic;

        bufferedAudioSources.UpdatePooledObjects(50);
        bufferedAudioSources.UpdatePooledObjects(0);
    }
Esempio n. 15
0
    private void PlaySound(int winStatus)
    {
        switch ((TugOfWarMinigame.WinStatus)winStatus)
        {
        case TugOfWarMinigame.WinStatus.Player1:
            if (PhotonNetwork.IsMasterClient)
            {
                AudioSFXReferences.PlayWin();
            }
            else
            {
                AudioSFXReferences.PlayLose();
            }
            break;

        case TugOfWarMinigame.WinStatus.Player2:
            if (PhotonNetwork.IsMasterClient)
            {
                AudioSFXReferences.PlayLose();
            }
            else
            {
                AudioSFXReferences.PlayWin();
            }
            break;

        case TugOfWarMinigame.WinStatus.Tie:
            break;

        case TugOfWarMinigame.WinStatus.None:
            break;

        default:
            break;
        }
    }
Esempio n. 16
0
 private void OnClick()
 {
     AudioSFXReferences.PlayButtonClick();
 }
Esempio n. 17
0
 public void OnClick()
 {
     AudioSFXReferences.PlayButtonClick();
 }
Esempio n. 18
0
 private void OnClick()
 {
     animator.SetTrigger("Hit");
     AudioSFXReferences.PlayButtonClick();
 }
Esempio n. 19
0
    public void OnNetworkEnable()
    {
        buttonPressObject.SetActive(false);

        AudioSFXReferences.PlayBadPurchase();
    }