示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (m_playerControl)
        {
            switch (m_FishingState)
            {
            case FishingMachine.Idle:
            {
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    m_Animator.SetTrigger("FishingAction");
                    m_Drifter.SwitchControlTypes(WalkControlLimits.NoWalk, LookControlLimits.VerticalOnly);
                    m_FishingState = FishingMachine.Fishing;
                    switch (m_FishermanStatus)
                    {
                    case FishermanStatus.NoFish:
                    {
                        SpawnFish();
                        m_FishermanStatus = FishermanStatus.Catching;
                        break;
                    }

                    case FishermanStatus.Catching:
                    {
                        m_FishermanStatus = FishermanStatus.NoFish;
                        break;
                    }
                    }
                    m_fishInstance.FishermanAction();
                }

                if (m_BoatWalker.SplinePos() >= 1f)
                {
                    QuitFishing();
                }
                break;
            }

            case FishingMachine.Fishing:
            {
                if (m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1.0f)
                {
                    m_Drifter.SwitchControlTypes(WalkControlLimits.NoWalk, LookControlLimits.FullControl);
                    m_FishingState = FishingMachine.Idle;
                }
                break;
            }
            }
        }
    }
示例#2
0
 private void SetComponents()
 {
     m_Animator        = GetComponent <Animator>();
     m_FishermanStatus = FishermanStatus.NoFish;
 }