Exemple #1
0
    /// <summary>
    /// Executes a shoot attack against other connected players
    /// </summary>
    public void Shoot(string playerId)
    {
        GameObject bullet;
        Rigidbody  bulletRigidbody;

        GameObject shootVFX = Instantiate(onShootVFX, bulletSpawnPoint.position, Quaternion.identity) as GameObject;

        Destroy(shootVFX, 0.5f);

        bullet = Instantiate(standardBulletPrefab) as GameObject;
        bullet.transform.rotation = bulletSpawnPoint.transform.rotation;
        bullet.transform.position = bulletSpawnPoint.position;
        bullet.tag = "Bullet" + playerId;
        playerScript.AddStress(weaponStress);
        playerRb.AddForce(playerRb.transform.forward * -recoilForce * Time.deltaTime, ForceMode.Impulse);
    }