コード例 #1
0
    private BaseEntity SelectTarget(AbilityData abilityData)
    {
        Roost.Debug.Assert(abilityData != null);
        BaseEntity baseEntity = null;

        if (abilityData.AutotargetData != null)
        {
            bool    flag             = this.m_baseCharacterController.IsDirectionIndicated();
            Vector3 desiredDirection = this.m_baseCharacterController.GetDesiredDirection();
            Vector3 vector3          = (!flag ? Singleton_MonoBehaviour <GameManager> .Instance.PlayerCamera.transform.forward : desiredDirection);
            vector3.y = 0f;
            vector3.Normalize();
            BaseEntity mPreviousTarget = null;
            if (this.m_previousTarget != null && Time.time - this.m_previousTargetTime < 0.75f && TargetingFilters.DoesTargetPassFilter(this, this.m_previousTarget, abilityData.TargetingFilters))
            {
                mPreviousTarget = this.m_previousTarget;
            }
            IEnumerable <BaseEntity> filteredTargets = TargetingFilters.GetFilteredTargets(this, abilityData.TargetingFilters);
            baseEntity = AutotargetData.SelectTarget(abilityData.AutotargetData, filteredTargets, mPreviousTarget, this, flag, desiredDirection);
        }
        return(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);
        }
    }