Exemple #1
0
        public void StartAiming(AimingBase aiming)
        {
            if (this.currentWeapon == null)
            {
                return;
            }
            if (this.currentAmmo == null)
            {
                return;
            }
            if (this.character != null)
            {
                if (!this.character.IsControllable())
                {
                    return;
                }
                if (this.character.characterLocomotion.isBusy)
                {
                    return;
                }
            }

            this.RequireAimIK();

            if (this.isDrawing)
            {
                return;
            }
            if (this.isHolstering)
            {
                return;
            }

            if (this.isChargingShot)
            {
                this.currentAmmo.StopCharge(this);
            }

            this.isAiming = true;
            this.aiming   = aiming;

            this.ChangeState(this.currentWeapon.aiming, Weapon.STATE_LAYER_AIM);
            if (this.aimIK)
            {
                this.aimIK.SetState(this.currentWeapon.aiming);
            }

            this.eventOnAim.Invoke(true);
            this.OnStartAimWeapon();
        }
Exemple #2
0
        public void StopAiming()
        {
            if (this.currentWeapon == null)
            {
                return;
            }
            if (this.currentAmmo == null)
            {
                return;
            }

            this.RequireAimIK();

            if (this.aiming != null)
            {
                this.aiming.Stop();
            }
            if (this.isChargingShot)
            {
                this.currentAmmo.StopCharge(this);
            }

            this.isAiming = false;
            this.aiming   = null;

            if (this.animator)
            {
                CharacterState currentState = this.animator.GetState(Weapon.STATE_LAYER_AIM);
                this.ResetState(currentState, Weapon.STATE_LAYER_AIM);
                if (this.aimIK)
                {
                    this.aimIK.SetState(this.currentWeapon.ease);
                }
            }

            this.eventOnAim.Invoke(false);
            this.OnStopAimWeapon();
        }