コード例 #1
0
ファイル: ObjectSpawn.cs プロジェクト: SirGeoffers/Swordship
    private void SpawnObject()
    {
        GameObject o = Instantiate(prefabToSpawn, this.transform.position, Quaternion.identity);

        Rigidbody2D rb = o.GetComponent <Rigidbody2D>();

        if (rb != null)
        {
            rb.angularVelocity = Random.Range(800, 1000);
        }

        Explosion e = Instantiate(explosionPrefab, this.transform.position, Quaternion.identity).GetComponent <Explosion>();

        e.IgnoreTarget(o);

        if (managerToNotify != null)
        {
            managerToNotify.AddObjectToTrack(o);
        }

        Destroy(this.gameObject);
    }