コード例 #1
0
    void DoBite(ref ActiveFishData fish)
    {
        fish.biteCount++;
        buttonSpriteRenderer.enabled = true;
        GameObject biteAnimationPrefab;
        float      bigBiteChance = fish.behaviour.bigBiteChance;

        if (_successfulSmallBites > 10)
        {
            bigBiteChance += 0.1f;
        }
        bool isBigBite = _successfulSmallBites > fish.behaviour.minSmallBites && Random.value < bigBiteChance;

        if (isBigBite)
        {
            _bigBiteSweetSpotTimer = bigBiteSweetSpotDuration;
            biteAnimationPrefab    = bigBiteAnimationPrefab;
            fish.targetBobber.animator.SetTrigger("BigBite");
        }
        else
        {
            _smallBiteSweetSpotTimer = smallBiteSweetSpotDuration;
            biteAnimationPrefab      = smallBiteAnimationPrefab;
            fish.targetBobber.animator.SetTrigger("SmallBite");
        }
        buttonAnimator.SetTrigger("Show");
        PoolManager.PoolInstantiate(biteAnimationPrefab, fish.position + biteNotificationOffset, Quaternion.identity);
        SetNextBiteInterval(ref fish);
        OneShotManager.PlayOneShot(biteOneShot);
    }
コード例 #2
0
    public void CatchFish(FishDataObject fish)
    {
        _recentlyCaughtFish.Add(fish);
        if (_recentlyCaughtFish.Count > 3)
        {
            _recentlyCaughtFish.RemoveAt(0);
        }

        fish.data.saveData.numberCaught++;
        if (!fish.data.saveData.unlocked)
        {
            fish.data.saveData.unlocked               = true;
            fish.data.saveData.timeFirstCaughtHours   = System.DateTime.Now.Hour;
            fish.data.saveData.timeFirstCaughtMinutes = System.DateTime.Now.Minute;
            // show phone and stuff
            phoneManager.UpdateProfileCell(fish);
            phoneManager.SetTargetProfile(fish);
            youGotAMatchScreen.ShowSuccess(fish, goToPhone: true);
            OneShotManager.PlayOneShot(catchUnlockOneShot);
        }
        else
        {
            youGotAMatchScreen.ShowSuccess(fish);
            OneShotManager.PlayOneShot(catchSuccessOneShot);
        }
    }
コード例 #3
0
 public void MissFish(int fishIndex)
 {
     MissFish(currentFishList[fishIndex]);
     ChangeFish(fishIndex);
     youGotAMatchScreen.ShowFail();
     OneShotManager.PlayOneShot(catchFailOneShot);
 }
コード例 #4
0
    public void HandleInput(RodAction action)
    {
        switch (action)
        {
        case RodAction.Cast:
            OneShotManager.PlayOneShot(castOneShot);
            animator.SetTrigger("CastStart");
            break;

        case RodAction.SmallBite:
            animator.SetTrigger("SmallBite");
            break;

        case RodAction.BigBite:
            bigBiteLoopSource.Play();
            animator.SetTrigger("BigBite");
            break;

        case RodAction.Reel:
            bigBiteLoopSource.Stop();
            OneShotManager.PlayOneShot(reelOneShot);
            animator.SetTrigger("ReelStart");
            break;

        case RodAction.Idle:
            break;
        }
    }
コード例 #5
0
 public void HidePhone()
 {
     phoneEnabled = false;
     phoneAnimator.SetTrigger("PhoneTransition");
     phoneAnimator.SetBool("PhoneEnabled", false);
     aimBehaviour.enabled = true;
     OneShotManager.PlayOneShot(backOneShot, 1f);
 }
コード例 #6
0
 public void ShowProfileScreen(FishDataObject fishProfile)
 {
     phoneScreen = PhoneScreen.Profile;
     LoadProfileData(fishProfile);
     matchesScreen.SetActive(false);
     newMatchScreen.SetActive(false);
     profileScreen.SetActive(true);
     OneShotManager.PlayOneShot(selectOneShot, 1f);
 }
コード例 #7
0
    void HandleInput()
    {
        switch (currentScreen)
        {
        case TitleScreen.Main:
            if (Input.GetKeyDown(KeyCode.Z))
            {
                HandleSelection(currentSelection);
                OneShotManager.PlayOneShot(selectOneShot);
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                MutateSelection(-1);
            }
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                MutateSelection(1);
            }
            break;

        case TitleScreen.Tutorial:
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (_tutorialIndex > 0)
                {
                    _tutorialIndex--;
                    OneShotManager.PlayOneShot(cursorOneShot);
                }
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (_tutorialIndex < tutorialSlides.Length - 1)
                {
                    _tutorialIndex++;
                    OneShotManager.PlayOneShot(cursorOneShot);
                }
            }
            if (Input.GetKeyDown(KeyCode.X))
            {
                HideTutorial();
                OneShotManager.PlayOneShot(backOneShot);
            }
            break;

        case TitleScreen.Credits:
            if (Input.GetKeyDown(KeyCode.X))
            {
                HideCredits();
                OneShotManager.PlayOneShot(backOneShot);
            }
            break;
        }
    }
コード例 #8
0
 public void ShowPhone(PhoneScreen screen, float delay = 0f)
 {
     if (delay > 0f)
     {
         _showTimer = delay;
         return;
     }
     _nextOpenScreen = screen;
     phoneEnabled    = true;
     phoneAnimator.SetTrigger("PhoneTransition");
     phoneAnimator.SetBool("PhoneEnabled", true);
     aimBehaviour.enabled = false;
     OneShotManager.PlayOneShot(showOneShot);
     gameStateManager.SaveGame();
 }
コード例 #9
0
    public void MutateSelectedCellIndex(int offset)
    {
        int index = _selectedCellIndex + offset;

        if (index < 0)
        {
            index += cellList.Count;
        }
        if (index >= cellList.Count)
        {
            index -= cellList.Count;
        }
        index = (int)Mathf.Clamp(index, 0, cellList.Count - 1);
        _selectedCellIndex = index;
        OneShotManager.PlayOneShot(cursorOneShot, 1f);
    }
コード例 #10
0
    void MutateSelection(int offset)
    {
        int index = _selectionIndex;

        index += offset;
        Debug.Log(index);
        if (index < 0)
        {
            index += _selectionOptions.Length;
        }
        else if (index >= _selectionOptions.Length)
        {
            index -= _selectionOptions.Length;
        }
        _selectionIndex = index;
        OneShotManager.PlayOneShot(cursorOneShot);
    }
コード例 #11
0
    void Start()
    {
        animationEventCallback += (BobberAnimationEvent e) => {
            switch (e)
            {
            case BobberAnimationEvent.SplashComplete:
                this.isInWater = true;
                break;

            case BobberAnimationEvent.LandInWaterOneShot:
                OneShotManager.PlayOneShot(landInWaterOneShot);
                break;

            case BobberAnimationEvent.ReelStart:
                this.isInWater = false;
                break;
            }
        };
    }
コード例 #12
0
 public override ActionError Execute(Interaction caller)
 {
     OneShotManager.Play(clip);
     return ActionError.None;
 }
コード例 #13
0
    void Update()
    {
        // TODO move this logic to fish manager
        if (mashMode)
        {
            _currentMashValue -= mashDecayRate * Time.deltaTime;
            _currentMashValue  = Mathf.Max(_currentMashValue, 0f);
            _mashTimer        -= Time.deltaTime;
            if (_mashTimer <= 0f)
            {
                FailCatch();
            }
        }

        if (_reelTimer > 0f)
        {
            _reelTimer -= Time.deltaTime;
            if (_reelTimer <= 0f)
            {
                DoReel();
            }
        }

        // pick spot
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (mashMode)
            {
                _currentMashValue += mashPressValue;
                SpawnHeartParticles();
                if (_currentMashValue > 1f)
                {
                    CompleteCatch();
                }
            }
            else if (rodBehaviour.currentState == RodState.Idle)
            {
                rodBehaviour.HandleInput(RodAction.Cast);
                reticleMover.gameObject.SetActive(false);
                bobberBehaviour.targetPosition = reticleMover.position;
                baitManager.Hide();
            }
            else if (rodBehaviour.currentState == RodState.WaitingForBite)
            {
                // OneShotManager.PlayOneShot(buttonPressClip);
                var biteResult = fishManager.TryGetBite();
                switch (biteResult)
                {
                case BiteResult.Invalid:
                    break;

                case BiteResult.SmallBiteSuccess:
                    buttonIndicatorAnimator.SetTrigger("GoodPress");
                    OneShotManager.PlayOneShot(goodPressOneShot);
                    SpawnHeartParticles();
                    rodBehaviour.HandleInput(RodAction.SmallBite);
                    break;

                case BiteResult.BiteFail:
                    buttonIndicatorAnimator.SetTrigger("BadPress");
                    OneShotManager.PlayOneShot(badPressOneShot);
                    rodBehaviour.HandleInput(RodAction.SmallBite);
                    break;

                case BiteResult.BigBiteSuccess:
                    mashMode          = true;
                    _currentMashValue = 0f;
                    _mashTimer        = mashMaxDuration;
                    buttonIndicatorAnimator.SetTrigger("MashTime");
                    rodBehaviour.HandleInput(RodAction.BigBite);
                    break;
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            buttonIndicatorAnimator.SetTrigger("Reset");
            if (rodBehaviour.currentState == RodState.WaitingForBite)
            {
                DoReel();
                fishManager.HandleReel();
            }
            reticleMover.gameObject.SetActive(true);
        }
    }
コード例 #14
0
 public void Awake()
 {
     _singleton = this;
 }
コード例 #15
0
    public void HandleInput()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (!phoneEnabled)
            {
                ShowPhone(PhoneScreen.Matches);
                _nextOpenScreen = PhoneScreen.Matches;
            }
            else
            {
                HidePhone();
            }
        }


        if (phoneEnabled)
        {
            switch (phoneScreen)
            {
            case PhoneScreen.Matches:
                if (Input.GetKeyDown(KeyCode.Z))
                {
                    if (selectedProfileCell.fishDataObject.data.saveData.unlocked)
                    {
                        ShowProfileScreen(selectedProfileCell.fishDataObject);
                    }
                }
                else if (Input.GetKeyDown(KeyCode.X))
                {
                    HidePhone();
                }

                const int columnWidth = 2;
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    MutateSelectedCellIndex(-columnWidth);
                }

                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    MutateSelectedCellIndex(columnWidth);
                }

                if (Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    MutateSelectedCellIndex(-1);
                }

                if (Input.GetKeyDown(KeyCode.RightArrow))
                {
                    MutateSelectedCellIndex(1);
                }

                break;

            case PhoneScreen.NewMatch:
                if (Input.GetKeyDown(KeyCode.Z))
                {
                    ShowProfileScreen(_targetProfile);
                }
                else if (Input.GetKeyDown(KeyCode.X))
                {
                    ShowMatches(_targetProfile);
                    OneShotManager.PlayOneShot(backOneShot, 1f);
                }
                break;

            case PhoneScreen.Profile:
                if (Input.GetKeyDown(KeyCode.X))
                {
                    ShowMatches();
                    OneShotManager.PlayOneShot(backOneShot, 1f);
                }
                float offset = profileScrollDelta / profileScrollViewContentTransform.sizeDelta.y;
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    profileBlurbScrollRect.verticalNormalizedPosition += offset;
                    if (profileBlurbScrollRect.verticalNormalizedPosition > 1f - offset)
                    {
                        profileBlurbScrollRect.verticalNormalizedPosition = 1f;
                    }
                    profileUpArrow.Press();
                }
                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    profileBlurbScrollRect.verticalNormalizedPosition -= profileScrollDelta / profileScrollViewContentTransform.sizeDelta.y;
                    if (profileBlurbScrollRect.verticalNormalizedPosition < offset)
                    {
                        profileBlurbScrollRect.verticalNormalizedPosition = 0f;
                    }
                    profileDownArrow.Press();
                }
                break;
            }
        }
    }