Exemple #1
0
 private void SetState(WeaponSpearController.State state)
 {
     if (this.m_SpearState == state)
     {
         this.OnEnterState();
         return;
     }
     this.m_Animator.SetInteger(this.m_StateHash, (int)state);
     this.m_Animator.speed = ((!this.IsAttack()) ? 1f : Skill.Get <SpearFishingSkill>().GetAnimationSpeedMul());
     if (state == WeaponSpearController.State.None)
     {
         this.m_SpearState = WeaponSpearController.State.None;
     }
 }
Exemple #2
0
    private void OnEnterState()
    {
        WeaponSpearController.State spearState = this.m_SpearState;
        switch (spearState)
        {
        case WeaponSpearController.State.UnAim:
        case WeaponSpearController.State.ThrowUnAim:
            this.m_Player.StopAim();
            break;

        case WeaponSpearController.State.AttackDown:
            this.Attack();
            this.m_WasWaterHit = false;
            this.m_CanHitWater = false;
            PlayerAudioModule.Get().PlayAttackSound(1f, false);
            this.m_Player.DecreaseStamina(this.m_Player.GetStaminaDecrease(StaminaDecreaseReason.Attack) * Skill.Get <SpearSkill>().GetStaminaMul());
            break;

        case WeaponSpearController.State.Attack:
            this.Attack();
            this.m_WasWaterHit = false;
            this.m_CanHitWater = false;
            PlayerAudioModule.Get().PlayAttackSound(1f, false);
            this.m_Player.DecreaseStamina(this.m_Player.GetStaminaDecrease(StaminaDecreaseReason.Attack) * Skill.Get <SpearSkill>().GetStaminaMul());
            this.m_Player.StopAim();
            break;

        default:
            if (spearState == WeaponSpearController.State.Aim)
            {
                this.m_Player.StartAim(Player.AimType.SpearFishing);
            }
            break;

        case WeaponSpearController.State.ThrowAim:
            this.m_Player.StartAim(Player.AimType.SpearHunting);
            break;

        case WeaponSpearController.State.Throw:
            this.m_Player.StopAim();
            this.m_Player.DecreaseStamina(this.m_Player.GetStaminaDecrease(StaminaDecreaseReason.Throw) * Skill.Get <SpearSkill>().GetStaminaMul());
            break;

        case WeaponSpearController.State.Presentation:
        {
            this.m_ImpaledObject.transform.parent = null;
            AI component = this.m_ImpaledObject.GetComponent <AI>();
            this.m_ImpaledIsStingRay = false;
            this.m_ImpaledArowana    = false;
            this.m_ImpaledPiranha    = false;
            AI.AIID id          = component.m_ID;
            Item    item        = ItemsManager.Get().CreateItem(id.ToString() + "_Body", false);
            Item    currentItem = this.m_Player.GetCurrentItem(Hand.Right);
            Vector3 b           = (currentItem.m_DamagerStart.position - currentItem.m_DamagerEnd.position).normalized * -0.07f;
            item.transform.rotation = currentItem.m_DamagerStart.rotation;
            if (component.m_ID == AI.AIID.Arowana)
            {
                this.m_ImpaledArowana = true;
                item.transform.Rotate(Vector3.forward, -60f);
            }
            else if (component.m_ID == AI.AIID.Piranha)
            {
                this.m_ImpaledPiranha = true;
                item.transform.Rotate(Vector3.forward, -90f);
            }
            else if (component.IsStringray())
            {
                this.m_ImpaledIsStingRay = true;
                item.transform.Rotate(Vector3.forward, -210f);
            }
            else
            {
                item.transform.Rotate(Vector3.forward, 0f);
                this.m_ImpaledIsStingRay = false;
            }
            item.transform.position       = currentItem.m_DamagerStart.position + b;
            item.transform.parent         = this.m_Player.GetCurrentItem(Hand.Right).transform;
            item.m_BlockGrabAnimOnExecute = true;
            item.m_AttachedToSpear        = true;
            this.m_ItemBody = item;
            UnityEngine.Object.Destroy(this.m_ImpaledObject.gameObject);
            this.m_ImpaledObject = null;
            item.m_CanBeOutlined = false;
            this.PlayCatchAnimation();
            break;
        }
        }
    }