예제 #1
0
    public override void OnUpdate()
    {
        var _anim = _animator.animator;
        AnimatorStateInfo animatorInfo;

        animatorInfo = _anim.GetCurrentAnimatorStateInfo(animLayer);

        _iKManager.SetAim(false);
        _iKManager.SetHold(false);

        if (animatorInfo.IsTag("reload"))
        {
            if (animatorInfo.normalizedTime >= exitTime)
            {
                if (_weaponAttribute.bore)
                {
                    _weaponAttribute.runtimeMag = _weaponAttribute.mag;
                }
                else
                {
                    _weaponAttribute.runtimeMag = _weaponAttribute.mag - 1;
                    _weaponAttribute.bore       = true;
                }

                var ammoMsg = new UiEvent.UiMsgs.Ammo()
                {
                    ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1 : 0),
                    mag  = _weaponAttribute.mag
                };
                _uiMgr.SendEvent(ammoMsg);

                this._exitTick = true;
            }
        }
    }
예제 #2
0
    public override void Enter()
    {
        base.Enter();

        process = 1;
        if (_weaponAttribute.active)
        {
            _animator.animator.SetTrigger("pickWeapon");
            _animator.animator.SetInteger("weaponTarget", (int)_weaponAttribute.type);
            _animator.AddEvent("weaponType", (int)_weaponAttribute.type);
            _iKManager.SetHoldTarget(_weaponAttribute.holdPoint);
            _iKManager.SetAim(false);
            _iKManager.SetHold(false);
            _iKManager.SetLook(true);

            endTimer.Enter(endTime);
            pickTimer.Enter(pickTime);

            _weaponHandle.locked = true;
            var cutMsg = new UiEvent.UiMsgs.WeaponCut()
            {
                texture = _weaponAttribute.cutPicInBattle
            };
            _uiMgr.SendEvent(cutMsg);

            var ammoMsg = new UiEvent.UiMsgs.Ammo()
            {
                ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1f : 0f),
                mag  = _weaponAttribute.mag
            };
            _uiMgr.SendEvent(ammoMsg);

            var spreadMsg = new UiEvent.UiMsgs.Spread()
            {
                value = _weaponAttribute.spread
            };
            _uiMgr.SendEvent(spreadMsg);
        }
        else
        {
            _weaponAttribute.constraint.weight = 1;
            foreach (var state in _weaponAttribute.states.Values)
            {
                if (!state._name.Equals(this._name))
                {
                    if (state._active)
                    {
                        state.Exit();
                    }
                }
            }
            _weaponAttribute.ready = false;
            this._exitTick         = true;
        }

        _iKManager.SetAim(false);
        _iKManager.SetHold(false);
    }
예제 #3
0
    public override void OnUpdate()
    {
        this.timer.Update();
        var _anim = _animator.animator;

        AnimatorStateInfo animatorInfo;

        animatorInfo = _anim.GetCurrentAnimatorStateInfo(animLayer);

        _iKManager.SetAim(false);

        if (process == 1)
        {
            _audioSource.PlayOneShot(sounds[0]);
            process = 2;
        }

        if (animatorInfo.IsTag("reload"))
        {
            if (process == 2)
            {
                if (animatorInfo.normalizedTime >= this.magInTime)
                {
                    _audioSource.PlayOneShot(sounds[1]);
                    if (_velocity.isLocalPlayer)
                    {
                        if (_weaponAttribute.bore)
                        {
                            _weaponAttribute.runtimeMag = _weaponAttribute.mag;
                        }
                        else
                        {
                            _weaponAttribute.runtimeMag = _weaponAttribute.mag - 1;
                            _weaponAttribute.bore       = true;
                        }

                        var ammoMsg = new UiEvent.UiMsgs.Ammo()
                        {
                            ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1 : 0),
                            mag  = _weaponAttribute.mag
                        };
                        _uiMgr.SendEvent(ammoMsg);
                    }
                    process = 3;
                }
            }
            else if (process == 3)
            {
                if (!this.timer.isRunning)
                {
                    this._exitTick = true;
                    process        = 4;
                }
            }
        }
    }
예제 #4
0
    void SendUiMsgs()
    {
        var ammoMsg = new UiEvent.UiMsgs.Ammo()
        {
            ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1 : 0),
            mag  = _weaponAttribute.mag
        };

        _uiMgr.SendEvent(ammoMsg);
    }