Esempio n. 1
0
    /// <summary>
    /// Removes the throwable from the character.
    /// </summary>
    /// <returns>Returns true if successfully removed the throwable, false otherwise.</returns>
    public override bool RemoveThrowable()
    {
        if (!throwable)
        {
            return(false);
        }

        throwable = null;

        if (CurrentThrowableAmount > 0)
        {
            Throwable = Throwables[0];

            // Updates juggling informations
            UpdateJuggleParameters(false);
        }
        else
        {
            // Triggers event
            if (photonView.isMine)
            {
                OnHasObject?.Invoke(false);
            }
        }

        if (CurrentThrowableAmount < MaxThrowableAmount)
        {
            // Activates the detection box
            interactionBox.DisplayInteractionFeedback(true);

            if (CurrentThrowableAmount == 0)
            {
                SetAnim(PlayerAnimState.LostObject);
            }
        }

        return(true);
    }
Esempio n. 2
0
    /// <summary>
    /// Set this character throwable.
    /// </summary>
    /// <param name="_throwable">Throwable to set.</param>
    /// <returns>Returns true if successfully set the throwable, false otherwise.</returns>
    public override bool SetThrowable(TDS_Throwable _throwable)
    {
        // Get if was juggling before taking this throwable
        bool _wasJuggling = CurrentThrowableAmount > 0;

        if (!_throwable)
        {
            return(false);
        }
        Throwable = _throwable;

        if (CurrentThrowableAmount > 0)
        {
            if (!_wasJuggling)
            {
                SetAnim(PlayerAnimState.HasObject);
            }

            // Updates juggling informations
            UpdateJuggleParameters(true);

            if (CurrentThrowableAmount == MaxThrowableAmount)
            {
                // Desactivates the detection box
                interactionBox.DisplayInteractionFeedback(false);
            }
        }

        // Triggers event
        if (photonView.isMine)
        {
            OnHasObject?.Invoke(true);
        }

        return(true);
    }