Пример #1
0
    public void SpawnEffect(SNSSTypes.WeaponType weapon)
    {
        GameObject go = null;

        switch (weapon)
        {
        case SNSSTypes.WeaponType.Regular:
            go = Instantiate(muzzleFlashEffect, spawnLocation.position, spawnLocation.rotation, spawnLocation);
            break;

        case SNSSTypes.WeaponType.Energy:
            go = Instantiate(muzzleFlashEffect, spawnLocation.position, spawnLocation.rotation, spawnLocation);
            break;

        case SNSSTypes.WeaponType.Charged:
            go = Instantiate(chargedEffect, spawnLocation.position, spawnLocation.rotation, spawnLocation);
            break;

        case SNSSTypes.WeaponType.Missiles:
            go = Instantiate(missileEffect, spawnLocation.position, spawnLocation.rotation, spawnLocation);
            break;
        }

        if (go)
        {
            Destroy(go, lifeTime);
        }
    }
Пример #2
0
    public void PlayShot(SNSSTypes.WeaponType weaponType)
    {
        shotSource.clip = null;

        if (weaponType == SNSSTypes.WeaponType.Regular && regularShotSound)
        {
            shotSource.clip = regularShotSound;
        }
        else if (weaponType == SNSSTypes.WeaponType.Energy && energyShotSound)
        {
            shotSource.clip = energyShotSound;
        }
        else if (weaponType == SNSSTypes.WeaponType.Missiles && missileShotSound)
        {
            shotSource.clip = missileShotSound;
        }

        if (shotSource.clip != null)
        {
            shotSource.Play();
        }
    }