Пример #1
0
    public override void Shoot()
    {
        PlayerShootInputs playerShootInputs = new PlayerShootInputs(playerId);

        if (playerShootInputs.shoot > 0 && Time.time > timeToNextFire)
        {
            playerStatus.blocked = true;
            charge += Time.deltaTime;
            RaycastHit2D hitInfo = Physics2D.Raycast(firePoint.position, firePoint.up);
            if (hitInfo)
            {
                DrawLine(firePoint.position, hitInfo.point, charge * 2.0f);
            }
            else
            {
                DrawLine(firePoint.position, firePoint.up.normalized * 999, charge * 2.0f);
            }

            if (charge > 0.15f)
            {
                Fire();
                charge               = 0.0f;
                timeToNextFire       = Time.time + 1f / fireRate;
                playerStatus.blocked = false;
            }
        }
        else
        {
            charge = 0;
            playerStatus.blocked = false;
        }
    }
Пример #2
0
    public override void Shoot()
    {
        PlayerShootInputs playerShootInputs = new PlayerShootInputs(playerId);

        if (playerShootInputs.shoot > 0 && Time.time > timeToNextFire)
        {
            Fire();
            timeToNextFire = Time.time + 1f / fireRate;
        }
    }