Пример #1
0
    // Use this for initialization
    void Start()
    {
        audioSource = GetComponent <AudioSource>();
        container   = AudioManager.instance.soundEffectContainer;

        Assert.IsNotNull(audioSource, "Need to add an AudioSource to " + name);
        Assert.IsNotNull(container, "Check the audiomanager ");

        AudioManager.instance.OnSoundEffectVolumeChange += OnVolumeChange;
    }
Пример #2
0
        public void FireCurrentWeapon(GraphicalObjectContainer graphicalObjects, SoundEffectContainer soundEffects)
        {
            if (this.shotDelayStopwatch.ElapsedMilliseconds > this.shotDelayTime && this.ShotsAvailable > 0)
            {
                graphicalObjects.Projectiles.Add(
                    new Projectile(
                        this.Xposition,
                        this.Yposition,
                        ConsoleColor.Cyan,
                        this.Direction,
                        ProjectileType.Player,
                        '*'));

                soundEffects.PlayShot();
                this.DecreaseShotsAvailable();
                this.shotDelayStopwatch.Restart();
            }

            this.PrintStatus();
        }
Пример #3
0
        public void FireWeapon(GraphicalObjectContainer graphicalObjects, SoundEffectContainer soundEffects)
        {
            if (this.shotDelayStopwatch.ElapsedMilliseconds > this.shotDelayTime)
            {
                graphicalObjects.Projectiles.Add(
                    new Projectile(
                        this.Xposition,
                        this.Yposition,
                        ConsoleColor.Red,
                        Direction.Up,
                        ProjectileType.Enemy,
                        '▲'));
                graphicalObjects.Projectiles.Add(
                    new Projectile(
                        this.Xposition,
                        this.Yposition,
                        ConsoleColor.Red,
                        Direction.Down,
                        ProjectileType.Enemy,
                        '▼'));
                graphicalObjects.Projectiles.Add(
                    new Projectile(
                        this.Xposition,
                        this.Yposition,
                        ConsoleColor.Red,
                        Direction.Left,
                        ProjectileType.Enemy,
                        '◄'));
                graphicalObjects.Projectiles.Add(
                    new Projectile(
                        this.Xposition,
                        this.Yposition,
                        ConsoleColor.Red,
                        Direction.Right,
                        ProjectileType.Enemy,
                        '►'));

                soundEffects.PlayEnemyShot();
                this.shotDelayStopwatch.Restart();
            }
        }
Пример #4
0
    private void MakeSingleton()
    {
        // Make a Singleton
        // If the static instance isnt null
        if (instance != null)
        {
            // We already have one Sound Manager Object In the Game, Destroy all others
            Destroy(gameObject);
        }
        else
        {
            // This is the first instance of Sound Manager, Store it and prevent it from dying.
            instance = this;
            DontDestroyOnLoad(gameObject);
            // Only Initialize once
        }

        if (soundEffectContainer == null)
        {
            soundEffectContainer = GetComponent <SoundEffectContainer>();
        }
    }
Пример #5
0
 public CollisionResolver(SoundEffectContainer soundEffects, ScoreContainer scoreContainer)
 {
     this.soundEffects   = soundEffects;
     this.scoreContainer = scoreContainer;
 }