Пример #1
0
    public static ExplodingEnemyBullet Create(Vector3 position, Vector3 direction)
    {
        Transform bulletTransform = Instantiate(GameAssets.instance.explodingEnemyBullet, position, Quaternion.identity);

        ExplodingEnemyBullet bullet = bulletTransform.GetComponent <ExplodingEnemyBullet>();

        bullet.Setup(direction);

        return(bullet);
    }
Пример #2
0
    private void OnDestroy()
    {
        if (!GameHandler.instance.isQuitting)
        {
            ExplodingEnemyBullet.Create(transform.position, new Vector3(1, 0, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(0, 1, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(-1, 0, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(0, -1, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(1, 1, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(1, -1, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(-1, -1, 0));
            ExplodingEnemyBullet.Create(transform.position, new Vector3(-1, 1, 0));

            Instantiate(DeathEffect, transform.position, Quaternion.identity);
            Destroy(gameObject);
            Coin.Create(transform.position, 3);
            GameHandler.instance.AddScore(45);
        }
    }