コード例 #1
0
 protected void SelectAttack(PlayerCharacter.ActionType attackType)
 //        protected virtual void SelectAttack(AbilityData abilityData, BaseEntity target)
 {
     if (!MyAbilitiesAdjusted)
     {
         AdjustAbilities();
         MyAbilitiesAdjusted = true;
     }
     //base.SelectAttack(PlayerCharacter.ActionType attackType);
     base.SetAttack(new AbilityData(), new BaseEntity());
 }
コード例 #2
0
    protected override void Update()
    {
        base.Update();
        this.UpdateCharacterUpgrades();
        this.m_playerPOI.Show = (this.IsControlledLocally ? false : !base.IsDead);
        bool flag = (this.Data == null ? false : this.Data.FuelCount > 0);

        this.m_personalPayloadFuelPOI.Show = (!flag ? false : this.IsControlledLocally);
        this.m_payloadFuelPOI.Show         = (!flag ? false : !this.IsControlledLocally);
        PickupData pickupDatum = null;

        if (this.Data != null)
        {
            pickupDatum = Singleton_MonoBehaviour <GameManager> .Instance.GameplayDatabase.PickupDataDatabase.FindOrGetDefault(this.Data.KeyPickupDataID);
        }
        if (pickupDatum != null)
        {
            this.m_personalKeyPOI.SetOverridePOISprite(pickupDatum.KeyPOISprite);
            this.m_keyPOI.SetOverridePOISprite(pickupDatum.KeyPOISprite);
        }
        this.m_personalKeyPOI.Show = (pickupDatum == null ? false : this.IsControlledLocally);
        this.m_keyPOI.Show         = (pickupDatum == null ? false : !this.IsControlledLocally);
        Roost.Debug.Assert(this.m_playerBlipTarget != null);
        this.m_playerBlipTarget.enabled = this.IsControlledLocally;
        Roost.Debug.Assert(this.m_teammateBlipTarget != null);
        this.m_teammateBlipTarget.enabled = !this.IsControlledLocally;
        PlayerCharacter mCanDodgeInAir = this;

        mCanDodgeInAir.m_canDodgeInAir = mCanDodgeInAir.m_canDodgeInAir | base.IsGrounded;
        PlayerCharacter mCanAttackInAir = this;

        mCanAttackInAir.m_canAttackInAir = mCanAttackInAir.m_canAttackInAir | base.IsGrounded;
        if (base.IsDead)
        {
            this.m_inAction = true;
            base.SetCurrentHitState(BaseEntity.HitState.Invincible);
            this.m_animation.CrossFade(this.m_playerAnimations.KOIdle.name, 0.1f);
        }
        if (this.IsControlledLocally && Singleton_MonoBehaviour <GameManager> .Instance.AllowPlayerControl && !Singleton_MonoBehaviour <GameManager> .Instance.State.ForcePlayerWalking())
        {
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.CameraCenter.WasPressed)
            {
                Singleton_MonoBehaviour <GameManager> .Instance.PlayerCamera.CenterCamera();
            }
            if (this.m_CounterTarget != null && !TargetingFilters.DoesTargetPassFilter(this, this.m_CounterTarget, this.m_playerAbilities.Counter.TargetingFilters))
            {
                this.m_CounterTarget = null;
            }
            if (this.m_CounterTarget == null)
            {
                float lastCounterTime = Single.MaxValue;
                IEnumerator <BaseCharacter> enumerator = TargetingFilters.GetFilteredTargets(this, this.m_playerAbilities.Counter.TargetingFilters).OfType <BaseCharacter>().GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        BaseCharacter current = enumerator.Current;
                        if (current.LastCounterTime >= lastCounterTime)
                        {
                            continue;
                        }
                        lastCounterTime      = current.LastCounterTime;
                        this.m_CounterTarget = current;
                    }
                }
                finally
                {
                    if (enumerator == null)
                    {
                    }
                    enumerator.Dispose();
                }
            }
            this.m_TeamAttackTarget = (
                from target in TargetingFilters.GetFilteredTargets(this, this.m_playerAbilities.TeamAttack.TargetingFilters).OfType <BaseCharacter>()
                orderby Vector3.Distance(base.transform.position, target.transform.position)
                select target).FirstOrDefault <BaseCharacter>();
            PlayerCharacter.ActionType mQueuedCombo = this.m_queuedCombo;
            int mQueuedindex = this.m_queuedindex;
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Dodge.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.Dodge;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Counter.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.Counter;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Attack.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.LightAttack;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Heavy.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.HeavyAttack;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Shoot.WasPressed || Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Shoot.WasRepeated)
            {
                mQueuedCombo = PlayerCharacter.ActionType.RangedAttack;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Taunt.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.Taunt;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Interact.WasReleased)
            {
                mQueuedCombo = PlayerCharacter.ActionType.TeamAttack;
            }
            if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Special_Keyboard.WasPressed)
            {
                mQueuedCombo = PlayerCharacter.ActionType.SpecialAttack;
            }
            if (base.Stats.CurrentSpecial > 0)
            {
                if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Special_Controller_LB.WasPressed)
                {
                    if (this.m_specialRightButtonTimer == null || this.m_specialRightButtonTimer.HasElapsed)
                    {
                        this.m_specialLeftButtonTimer = new Timer(0.1f);
                    }
                    else
                    {
                        mQueuedCombo = PlayerCharacter.ActionType.SpecialAttack;
                    }
                }
                if (Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Special_Controller_RB.WasPressed)
                {
                    if (this.m_specialLeftButtonTimer == null || this.m_specialLeftButtonTimer.HasElapsed)
                    {
                        this.m_specialRightButtonTimer = new Timer(0.1f);
                    }
                    else
                    {
                        mQueuedCombo = PlayerCharacter.ActionType.SpecialAttack;
                    }
                }
            }
            if (!this.m_uninterruptibleAbility)
            {
                this.m_queuedCombo = mQueuedCombo;
                this.m_queuedindex = mQueuedindex;
            }
            if (!base.IsDead && !base.IsHit && !this.m_failedCounter && !this.m_uninterruptibleAbility)
            {
                Action action = () => {
                    this.m_queuedCombo = PlayerCharacter.ActionType.None;
                    this.m_queuedindex = 0;
                };
                if (this.m_queuedCombo == PlayerCharacter.ActionType.Counter)
                {
                    Roost.Debug.Assert(this.m_playerAbilities.Counter != null);
                    Roost.Debug.Assert(this.m_playerAbilities.FailedCounter != null);
                    if (base.InAction)
                    {
                        this.Cancel();
                    }
                    if (this.m_CounterTarget != null)
                    {
                        base.UseAbility(this.m_playerAbilities.Counter, this.m_CounterTarget);
                    }
                    else if (base.IsGrounded)
                    {
                        base.UseAbility(this.m_playerAbilities.FailedCounter, null);
                    }
                    action();
                }
                if (this.m_queuedCombo == PlayerCharacter.ActionType.TeamAttack && this.m_playerAbilities.TeamAttack != null && this.m_TeamAttackTarget != null)
                {
                    if (base.InAction)
                    {
                        this.Cancel();
                    }
                    base.UseAbility(this.m_playerAbilities.TeamAttack, this.m_TeamAttackTarget);
                    action();
                }
                if (!base.InAction || this.m_canPerformCombo)
                {
                    switch (this.m_queuedCombo)
                    {
                    case PlayerCharacter.ActionType.Dodge:
                    {
                        if (this.m_canDodge && this.m_canDodgeInAir && Singleton_MonoBehaviour <GameManager> .Instance.PlayerCamera.LockOnTarget == null)
                        {
                            base.NotifyCamera();
                            this.m_canDodgeInAir = false;
                            base.UseAbility((!base.IsGrounded ? this.m_playerAbilities.DodgeAir : this.m_playerAbilities.DodgeLand), null);
                        }
                        goto case PlayerCharacter.ActionType.TeamAttack;
                    }

                    case PlayerCharacter.ActionType.Counter:
                    case PlayerCharacter.ActionType.LightAttack:
                    case PlayerCharacter.ActionType.HeavyAttack:
                    case PlayerCharacter.ActionType.RangedAttack:
                    {
                        this.SelectAttack(this.m_queuedCombo);
                        goto case PlayerCharacter.ActionType.TeamAttack;
                    }

                    case PlayerCharacter.ActionType.SpecialAttack:
                    {
                        if (this.m_playerAbilities.SpecialAttack != null)
                        {
                            if (base.Stats.CurrentSpecial >= this.m_playerAbilities.SpecialAttack.SpecialCost)
                            {
                                this.m_statsScript.AddSpecial(-this.m_playerAbilities.SpecialAttack.SpecialCost);
                                base.UseAbility(this.m_playerAbilities.SpecialAttack, null);
                            }
                            else if (this.event_OnNotEnoughAura != null)
                            {
                                this.event_OnNotEnoughAura();
                            }
                        }
                        goto case PlayerCharacter.ActionType.TeamAttack;
                    }

                    case PlayerCharacter.ActionType.TeamAttack:
                    {
                        action();
                        break;
                    }

                    case PlayerCharacter.ActionType.Taunt:
                    {
                        base.UseAbility(this.m_playerAbilities.Taunt, null);
                        goto case PlayerCharacter.ActionType.TeamAttack;
                    }

                    default:
                    {
                        goto case PlayerCharacter.ActionType.TeamAttack;
                    }
                    }
                }
            }
            this.m_isSprinting = Singleton_MonoBehaviour <ApplicationManager> .Instance.PlayerInput.Dodge.IsPressed;
            this.m_animation[this.m_baseAnimations.Run.name].speed = Mathf.Lerp(this.m_animation[this.m_baseAnimations.Run.name].speed, (!this.m_isSprinting ? 1f : this.m_sprintAnimationSpeed), 5f * Time.deltaTime);
            base.MovementSpeedModifier = Mathf.Lerp(base.MovementSpeedModifier, (!this.m_isSprinting ? 1f : this.m_sprintSpeedMultiplier), 1f * Time.deltaTime);
        }
    }
コード例 #3
0
    private void SelectAttack(PlayerCharacter.ActionType attackType)
    {
        PlayerCharacter.ActionType actionType;
        base.NotifyCamera();
        if (!this.m_inLightAction || !base.IsGrounded)
        {
            actionType = attackType;
            switch (actionType)
            {
            case PlayerCharacter.ActionType.LightAttack:
            {
                if (base.IsGrounded)
                {
                    this.UseAutotargetAbility(this.m_playerAbilities.LightCombo[this.m_comboCounters[PlayerCharacter.ComboType.Melee]]);
                }
                else if (this.m_canAttackInAir)
                {
                    this.UseAutotargetAbility(this.m_playerAbilities.LightComboAir[this.m_comboCounters[PlayerCharacter.ComboType.Melee]]);
                }
                break;
            }

            case PlayerCharacter.ActionType.HeavyAttack:
            {
                if (base.IsGrounded)
                {
                    if (this.m_comboCounters[PlayerCharacter.ComboType.Melee] != 0)
                    {
                        this.UseAutotargetAbility(this.m_playerAbilities.HeavyCombo[this.m_comboCounters[PlayerCharacter.ComboType.Melee] - 1]);
                    }
                    else
                    {
                        this.UseAutotargetAbility(this.m_playerAbilities.HeavyBasic);
                    }
                }
                else if (this.m_canAttackInAir)
                {
                    this.UseAutotargetAbility(this.m_playerAbilities.HeavyComboAir);
                }
                break;
            }

            case PlayerCharacter.ActionType.RangedAttack:
            {
                if (this.m_canAttackInAir)
                {
                    this.UseAutotargetAbility(this.m_playerAbilities.RangedCombo[this.m_comboCounters[PlayerCharacter.ComboType.Ranged]]);
                }
                break;
            }
            }
        }
        else
        {
            actionType = attackType;
            if (actionType == PlayerCharacter.ActionType.LightAttack)
            {
                this.UseAutotargetAbility(this.m_playerAbilities.LightDodgeAttack);
                this.m_inLightAction = false;
            }
            else if (actionType == PlayerCharacter.ActionType.HeavyAttack)
            {
                this.UseAutotargetAbility((this.m_comboCounters[PlayerCharacter.ComboType.Melee] <= 0 ? this.m_playerAbilities.HeavyCombo.FirstOrDefault <AbilityData>() : this.m_playerAbilities.HeavyCombo[this.m_comboCounters[PlayerCharacter.ComboType.Melee] - 1]));
                this.m_inLightAction = false;
            }
        }
    }
コード例 #4
0
 protected void ResetComboFlags()
 {
     this.m_canPerformCombo = false;
     this.m_queuedCombo     = PlayerCharacter.ActionType.None;
     this.m_queuedindex     = 0;
 }