コード例 #1
0
ファイル: Shoot.cs プロジェクト: SamNilsson172/LootShoot
    void SpawnBullet(Weapon weapon) //spawn a bullet and asign its values
    {
        GameObject bullet = Instantiate(Resources.Load <GameObject>(Weapon.bulletPrefabPath));

        bullet.transform.position = transform.position;
        bullet.transform.rotation = transform.rotation;
        BulletBehaviour bulletBehaviour = bullet.GetComponent <BulletBehaviour>();

        bulletBehaviour.dmg   = weapon.dmg;
        bulletBehaviour.speed = weapon.bulletSpeed;
        bulletBehaviour.GetComponent <MeshFilter>().sharedMesh       = Resources.Load <GameObject>(weapon.bulletMeshPath).GetComponent <MeshFilter>().sharedMesh;
        bulletBehaviour.GetComponent <MeshRenderer>().sharedMaterial = Resources.Load <GameObject>(weapon.bulletMeshPath).GetComponent <MeshRenderer>().sharedMaterial;
    }
コード例 #2
0
ファイル: StatusBullet.cs プロジェクト: sugichan0116/BoxWarII
    private string SubText()
    {
        string text = "";

        ExplosionBehaviour e = prefabBullet.GetComponent <ExplosionBehaviour>();

        if (e != null)
        {
            text += e.Text();
        }

        ShotgunBehaviour s = prefabBullet.GetComponent <ShotgunBehaviour>();

        if (s != null)
        {
            text += s.Text();
        }

        return(text);
    }