コード例 #1
0
ファイル: Shooter.cs プロジェクト: clt85046/Run-Joey-Run
    public void SetBullet(string newBulletName)
    {
        bulletName = newBulletName;
        GameObject newBullet    = bulletsManager.GetBulletByName(newBulletName);
        Bullet     bulletDetail = newBullet.GetComponent <Bullet>();

        shootDelay = bulletDetail.delay;
    }
コード例 #2
0
ファイル: OnlinePlayer.cs プロジェクト: clt85046/Run-Joey-Run
    void CmdFire(Vector3 firePos, Quaternion fireRotation, string id, string bulletName)
    {
        GameObject bulletPrefab = bulletsManager.GetBulletByName(bulletName);
        //Debug.Log(bulletName);
        var bullet = (GameObject)Instantiate(bulletPrefab,
                                             firePos, fireRotation);

        bullet.GetComponent <Bullet>().OnInstantiateSetPlayerID(id);
        //Debug.Log("playerid " + id);
        bullet.GetComponent <Rigidbody>().velocity = bullet.transform.forward * bullet.GetComponent <Bullet>().speed;
        NetworkServer.Spawn(bullet);
        bullet.transform.parent = bulletsParent.transform;  //TODO: fix this, not working on clients
        preFireTime             = Time.timeSinceLevelLoad;
    }