Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Space))
     {
         roundScript.Charge(m_chargeTime);
     }
     if (Input.GetKeyUp(KeyCode.Space))
     {
         if (fireDirection == Vector3.zero)
         {
             roundScript.Fire(speed);
         }
         else
         {
             roundScript.Fire(speed, fireDirection);
         }
     }
 }
Пример #2
0
    private void Update()
    {
        if (!_isCharging)
        {
            animator.SetBool("chargingShotAni", false);
            GetComponent <SphereCollider>().enabled = true;
            if (_charge < .2)
            {
                //_rb.MovePosition(transform.position + transform.forward * 0.2f * Time.deltaTime * _moveSpeed);
                _vfxController.Fire(_moveSpeed * 0.2f);
            }
            else
            {
                //_rb.MovePosition(transform.position + transform.forward * _charge * Time.deltaTime * _moveSpeed);
                _vfxController.Fire(_moveSpeed * _charge);
            }
        }
        else
        {
            animator.SetBool("chargingShotAni", true);

            _charge = _altFire.Charge;

            transform.position = _altFire.GunEnd.position;
            transform.rotation = _altFire.GunEnd.rotation;
            //transform.localScale = _startScale + Vector3.one * _charge * _scaleMultiplier;

            _hitbox.baseDamage = 5 + _charge * _damageMultiplier;

            _vfxController.Charge((1 / _altFire.ChargeRate));

            /*
             * var shape = _vfx.shape;
             * shape.radius = 0.6f + (_charge);
             *
             * var emission = _vfx.emission;
             * emission.rateOverTime = 140f + (_charge) * 100f;
             *
             * var trail = _vfx.GetComponentInChildren<TrailRenderer>();
             * trail.widthMultiplier = .2f + (_charge);
             */
        }
    }