Beispiel #1
0
    AudioSource voiceSource;             //Reference to the generated voice Audio Source

    void Awake()
    {
        if (current == null)
        {
            current = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (current != this)
        {
            Debug.Log("not the instance " + name);
            Destroy(gameObject);
        }

        //Generate the Audio Source "channels" for our game's audio
        musicSource   = gameObject.AddComponent <AudioSource>() as AudioSource;
        ambientSource = gameObject.AddComponent <AudioSource>() as AudioSource;
        stingSource   = gameObject.AddComponent <AudioSource>() as AudioSource;
        playerSource  = gameObject.AddComponent <AudioSource>() as AudioSource;
        voiceSource   = gameObject.AddComponent <AudioSource>() as AudioSource;

        //Assign each audio source to its respective mixer group so that it is
        //routed and controlled by the audio mixer
        musicSource.outputAudioMixerGroup   = musicGroup;
        ambientSource.outputAudioMixerGroup = ambientGroup;
        stingSource.outputAudioMixerGroup   = stingGroup;
        playerSource.outputAudioMixerGroup  = playerGroup;
        voiceSource.outputAudioMixerGroup   = voiceGroup;
    }
    // Start is called before the first frame update
    void Start()
    {
        AM = GameObject.Find("AudioManager").GetComponent <AudioMaster>();

        ruleBook = GetComponent <RuleBook>();
        GM       = GetComponent <GameManager>();
        TE       = FindObjectOfType <TrapEvent>();

        //foreach(GameObject sign in signs)
        //{
        //   DontDestroyOnLoad(sign);
        //}

        truthfulSigns = new List <bool> {
        };
        allRooms      = new List <RoomStats> {
        };

        // Make a new room with some stats. This will have to read back info from the manager object with room generation
        ruleBook.AddNewRule();
        CreateNewRoom();
        newRuleHint.gameObject.SetActive(true);
        if (allRooms.Count == 0)
        {
            hintText.text = "Press 'A' or 'D' to check out your environment. \n[A][D]";
        }
    }
Beispiel #3
0
    void Start()
    {
        AudioM = this;

        _AudioObjects = GameObject.FindGameObjectsWithTag("Audio");
        StartCoroutine(LateStart());
    }
    private void HitscanHit(RaycastHit hit, float pierceMult)
    {
        if (hit.transform.GetComponent <Unit>())
        {
            float falloffMult = hit.distance - pj.falloffRange;
            // Is within falloff range
            if (falloffMult <= 0f)
            {
                falloffMult = 1f;
            }
            else
            {
                falloffMult = 1 / (falloffMult * pj.falloffRate);
            }
            hit.transform.GetComponent <Unit>().Hurt(pj.damage * pierceMult * falloffMult);

            // Create sound and decal
            AudioMaster.Create(pj.soundHit, transform.position);
            GameObject prf = InstantiatePrefab(pj.decalEnd) as GameObject;
            prf.transform.rotation = transform.rotation;
            prf.transform.position = hit.point;
            prf.transform.parent   = hit.transform;
        }
        else
        {
            GameObject prf = InstantiatePrefab(pj.decalEnd) as GameObject;
            prf.transform.rotation = hit.normal;
            prf.transform.posiiton = hit.point;
            AudioMaster.Create(pj.soundBounce, transform.position);
        }
    }
 private void OnCollisionEnter(Collision collision)
 {
     // Hits a unit
     if (collision.gameObject.tag == "Unit")
     {
         Unit unit = collision.gameObject.GetComponent <Unit>();
         if (unit.unitID == ownerID)
         {
             // Disc return
             Kill();
         }
         else
         {
             AudioMaster.Create(pj.soundHit, transform.position);
             unit.Hurt(pj.damage);
             pj.bounces = pj.killOnHurt ? 1 : pj.bounces;
         }
     }
     pj.bounces--;
     if (pj.bounces == 0)
     {
         GameObject prf = InstantiatePrefab(pj.decalEnd) as GameObject;
         prf.transform.rotation = transform.rotation;
         prf.transform.position = transform.position;
         AudioMaster.Create(pj.soundBounce, transform.position);
         Kill();
     }
     else
     {
         GameObject prf = InstantiatePrefab(pj.decalBounce) as GameObject;
         prf.transform.rotation = transform.rotation;
         prf.transform.position = transform.position;
         AudioMaster.Create(pj.soundBounce, transform.position);
     }
 }
 // Near miss
 private void OnTriggerExit(Collider collider)
 {
     if (collider.gameObject.tag == "Unit")
     {
         AudioMaster.Create(pj.soundMiss, transform.position);
     }
 }
Beispiel #7
0
        private async Task RunConnect()
        {
            var ct      = ProcessCancel.Token;
            var taskSet = new HashSet <Task>();

            var blockSize = (int)(Param.SamplingRate * Param.SampleLength);

            Logger.LogInformation($"[loop3] blockSize {blockSize}");

            var audioInterval = (long)(10_000_000.0 * Param.SampleLength);

            Logger.LogInformation($"[loop3] audioInterval {audioInterval}");
            var videoInterval = (long)(10_000_000.0 / Param.MaxFrameRate);

            Logger.LogInformation($"[loop3] videoInterval {videoInterval}");

            var counter = new ElapsedTimeCounter();

            using var audioWaiter   = new Waiter(counter, audioInterval);
            using var videoWaiter   = new Waiter(counter, videoInterval);
            using var buf           = new IPCBuffer <float>(Param.EffectName, blockSize * 2 * Param.BufferCount, LoggerFactory);
            using var vstBufferPool = new BufferPool <VstBuffer2 <float> >(Param.BufferCount, () => new VstBuffer2 <float>(blockSize, 2, buf), LoggerFactory);
            using var pcmPool       = new BufferPool <PcmBuffer <float> >(Param.BufferCount, () => new PcmBuffer <float>(blockSize, 2), LoggerFactory);
            using var audioPool     = new BufferPool <OpusOutputBuffer>(Param.BufferCount, () => new OpusOutputBuffer(5000), LoggerFactory);
            using var pcmDrowPool   = new BufferPool <PcmBuffer <float> >(Param.BufferCount, () => new PcmBuffer <float>(blockSize, 2), LoggerFactory);
            using var bmpPool       = new BufferPool <H264InputBuffer>(Param.BufferCount, () => new H264InputBuffer(Param.Width, Param.Height), LoggerFactory);
            using var videoPool     = new BufferPool <H264OutputBuffer>(Param.BufferCount, () => new H264OutputBuffer(200000), LoggerFactory);
            using var vst           = new AudioMaster <float>(Param.SamplingRate, blockSize, LoggerFactory, counter, DllManager);
            using var toPcm         = new ToPcm <float>(LoggerFactory, counter);
            using var opus          = new OpusEncoder(SamplingRate.Sampling48000, Channels.Stereo, LoggerFactory, counter);
            using var fft           = new FFTEncoder(Param.Width, Param.Height, Param.MaxFrameRate, LoggerFactory, counter);
            using var h264          = new H264Encoder(Param.Width, Param.Height, Param.TargetBitrate, Param.MaxFrameRate, LoggerFactory, counter);
            var effect = vst.AddEffect(Param.EffectName);

            using var ftl = new FtlIngest(StreamKey, IngestHostname, LoggerFactory, counter, audioInterval, videoInterval, default, CaInfoPath);
        private void RemovePlayer(string playerName)
        {
            int index = Players.FindIndex(p => p.Name == playerName);

            if (index == -1)
            {
                return;
            }

            if (sndLeaveSound != null)
            {
                AudioMaster.PlaySound(sndLeaveSound);
            }

            Players.RemoveAt(index);

            CopyPlayerDataToUI();

            if (!IsHost && playerName == hostName && !ProgramConstants.IsInGame)
            {
                connectionManager.MainChannel.AddMessage(new ChatMessage(null,
                                                                         Color.Yellow, DateTime.Now, "The game host left the game!"));

                Clear();
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     QTEevents = new string[] { "ASDF", "NOUIDIOT", "THINKFAST", "EIFUHWKY", "IMOUTOFIDEAS", "MIDDLEDOOR", "LEFTDOOR", "LYING", "SAFE", "RIGHTDOOR", "ROCK", "MUSHROOM", "SIGNISLYING", "CANURAED", "JEFFWENTLEFT", "WWVWWV" };
     //StartTrap();
     GM = GameObject.Find("LogicHandler").GetComponent <GameManager>();
     AM = GameObject.Find("AudioManager").GetComponent <AudioMaster>();
 }
Beispiel #10
0
        }// -----------------------------------------

        // --
        private void PanelCompress_Load(object sender, EventArgs e)
        {
            // -- Some Tooltips
            ToolTip tt = new ToolTip();

            //tt.SetToolTip(chk_encodedCue, "Encodes audio tracks and creates a .CUE file that handles data and encoded audio tracks. Doesn't create a final archive. This format can be used in some emulators.");
            tt.SetToolTip(pictureBox1, "You can optionally set an image cover for this CD and it will be stored in the archive.");

            // -- Initialize combobox Audio Compression
            foreach (var codecID in AudioMaster.codecs)
            {
                combo_audio_c.Items.Add(AudioMaster.getCodecIDName(codecID));
            }

            combo_audio_c.SelectedIndex = 0;
            combo_audio_c_SelectedIndexChanged(null, null);    // force first call? why

            // -- Initialize combobox Archive Compression
            foreach (var cs in ArchiveMaster.compressionStrings)
            {
                combo_data_c.Items.Add(cs);
            }

            combo_data_c.SelectedIndex = ArchiveMaster.DEFAULT_INDEX;

            // --
            combo_method.SelectedIndex = 0;

            FormTools.fileLoadDialogPrepare("cue", "CUE files (*.cue)|*.cue");
            FormTools.fileLoadDialogPrepare("cover", "Image files (*.jpg)|*.jpg");

            // --
            form_prepare_init();
        }// -----------------------------------------
Beispiel #11
0
    public void StartLevelAudio()
    {
        //Set the clip for ambient audio, tell it to loop, and then tell it to play
        AudioMaster.PlayMusic(musicClip);

        //Set the clip for music audio, tell it to loop, and then tell it to play
        AudioMaster.PlayAmbient(ambientClip);
    }
Beispiel #12
0
 // Use this for initialization
 void Start()
 {
     levelFadeAnim = GameObject.Find("LevelFade").GetComponent <Animator>();
     audioMast     = AudioMaster.instance;
     exitPoint     = GameObject.FindWithTag("Exit").GetComponent <Transform>();
     playerScript  = GameObject.Find("Player").GetComponent <PlayerController>();
     nlgMan        = playerScript.gameObject.GetComponent <NLGManager>();
 }
Beispiel #13
0
    IEnumerator PlayRandomSound()
    {
        AudioMaster.PlaySting(randomSounds[Random.Range(0, randomSounds.Length)]);

        yield return(new WaitForSeconds(Random.Range(2f, 5f)));

        StartCoroutine(PlayRandomSound());
    }
        protected override void SendChatMessage(string message)
        {
            if (sndMessageSound != null)
            {
                AudioMaster.PlaySound(sndMessageSound);
            }

            channel.SendChatMessage(message, chatColor);
        }
Beispiel #15
0
    public override void OnEnter()
    {
        Chunk parentChunk = GetComponentInParent <Chunk>();

        GameData.chunkId     = parentChunk.chunkId;
        GameData.playerSpeed = References.Runner.GetState <RunnerRunning>().speed;

        AudioMaster.PlayNextAudioClip();
    }
        private void Channel_MessageAdded(object sender, IRCMessageEventArgs e)
        {
            lbChatMessages.AddMessage(e.Message);

            if (sndMessageSound != null && e.Message.Sender != null)
            {
                AudioMaster.PlaySound(sndMessageSound);
            }
        }
Beispiel #17
0
    void Start()
    {
        //Keeps the backpack closed at the start
        flarePack.SetActive(false);
        healthPack.SetActive(false);
        emptyPack.SetActive(false);
        closedPack.SetActive(true);

        play = GameObject.Find("AudioManager").GetComponent <AudioMaster>();
        GM   = GameObject.Find("LogicHandler").GetComponent <GameManager>();
    }
Beispiel #18
0
 // [[ ----- AWAKE ----- ]]
 private void Awake()
 {
     if (active == null)
     {
         active = this;
     }
     else
     {
         Destroy(this);
     }
 }
Beispiel #19
0
        protected override void OnLoad(EventArgs e)
        {
            scene = new Scene("Scene");
            LevelManager.activeScene = scene;

            GL.Enable(EnableCap.DepthTest);

            isCursorVisible = CursorVisible = false;
            VSync           = VSyncMode.On;

            Camera.main = new Camera(Width / Height);

            imguiRenderer = new ImGuiRenderer("Assets/Shaders/imgui.glsl", Width, Height);

            GameObject lightGO = new GameObject("Light Source");
            var        light   = new LightSource("Light", lightGO);

            lightGO.AddComponent(light);

            GameObject cubeGO = new GameObject("Cube");
            var        cube   = new Cube("Assets/container.jpg", cubeGO);

            cube.Parent.getMatrix4X4() *= Matrix4x4.CreateScale(10, 0.1f, 10);
            cube.Parent.getMatrix4X4() *= Matrix4x4.CreateTranslation(0, -1f, 0);
            cubeGO.AddComponent(cube);

            var modelGO = new GameObject("Model");

            /* modelGO.AddComponent(new Model("Assets/Mesh/Nanosuit/", "nanosuit.obj", modelGO));
             * modelGO.GetComponent<Model>().Parent.getMatrix4X4() *= Matrix4x4.CreateTranslation(0, -1.75f, 0);
             * modelGO.GetComponent<Model>().Parent.getMatrix4X4() *= Matrix4x4.CreateScale(.2f, .2f, .2f);
             * modelGO.GetComponent<Model>().isRotating = true;*/

            modelGO.AddComponent(new Model("Assets/Mesh/Sponza/", "sponza.obj", modelGO));

            scene.Add(modelGO);
            scene.Add(cubeGO);

            scene.Add(lightGO);

            imguiInput = new ImGuiInput();

            MouseDown  += (sender, args) => MasterInput.MouseEvent(args);
            MouseUp    += (sender, args) => MasterInput.MouseEvent(args);
            MouseMove  += (sender, args) => MasterInput.MouseEvent(args);
            MouseWheel += (sender, args) => MasterInput.MouseEvent(args);

            presentationSource = AudioMaster.LoadSourceAndSound("Assets/Sound/bounce.wav");
            presentationSource.SetPosition(Vector3.Zero);

            //RunSimulation();

            base.OnLoad(e);
        }
 void Start()
 {
     //All statements in this method set the variables to the correct components of the correct GameObjects.
     boltBar      = GameObject.Find("boltBar").GetComponent <RectTransform>();
     playerRgdBdy = GetComponent <Rigidbody2D>();
     wallL        = GameObject.Find("wallLeft").GetComponent <CircleCollider2D>();
     wallR        = GameObject.Find("wallRight").GetComponent <CircleCollider2D>();
     groundCircle = GetComponent <CircleCollider2D>();
     nlgMan       = GetComponent <NLGManager>();
     audioMast    = AudioMaster.instance;
 }
Beispiel #21
0
 public void Awake()
 {
     if (AudioMaster.instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else if (this != instance)
     {
         Destroy(this.gameObject);
     }
 }
Beispiel #22
0
 void Start()
 {
     playerNlg = GameObject.Find("Player").GetComponent <NLGManager>();
     wBoxEnemy.SetActive(false);
     enemyRgdBdy   = GetComponent <Rigidbody2D>();
     RangeA        = transform.position.x + rangeRadius;
     RangeB        = transform.position.x - rangeRadius;
     SpawnX        = transform.position.x;
     SpawnY        = transform.position.y;
     audioMast     = AudioMaster.instance;
     respawnScript = GameObject.Find("mournerCircle").GetComponent <RespawnManager>();
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
 }
Beispiel #24
0
 private void Singleton()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else if (instance != this)
     {
         Debug.Log("not the instance " + name);
         Destroy(gameObject);
     }
 }
Beispiel #25
0
 void Start()
 {
     quickSuccessionFallsCount = 0;
     quickSuccessionFallsTime  = 0;
     quickSuccessionStabsCount = 0;
     quickSuccessionStabsTime  = 0;
     deathTextAppear           = GameObject.Find("DeathTextAppear").GetComponent <Text>();
     audioMast        = AudioMaster.instance;
     enemyGameObjects = GameObject.FindGameObjectsWithTag("Enemy");
     playerScript     = GameObject.Find("Player").GetComponent <PlayerController>();
     playerNlg        = GameObject.Find("Player").GetComponent <NLGManager>();
     spawnPoint       = gameObject; //reference the spawn location
 }
Beispiel #26
0
    // Start is called before the first frame update
    void Awake()
    {
        // Singleton pattern
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Beispiel #27
0
 void Awake()
 {
     if (instance != null)
     {
         if (instance != this)
         {
             Destroy(gameObject);
         }
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
 }
Beispiel #28
0
    void Start()
    {
        Cursor.visible = true;

        howToPlay.SetActive(false);
        open.SetActive(false);

        playButton.SetActive(true);
        rulesButton.SetActive(true);
        exitButton.SetActive(true);
        title.SetActive(true);

        play    = GameObject.Find("AudioManager").GetComponent <AudioMaster>();
        mainCam = Camera.main;
    }
Beispiel #29
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            if (!Focused)
            {
                return;
            }

            Time.deltaTime = (float)e.Time;
            //inputState.Update(Keyboard.GetState());
            MasterInput.Update();
            AudioMaster.Update();

            HandleInput();
        }
        private void Channel_UserAdded(object sender, ChannelUserEventArgs e)
        {
            PlayerInfo pInfo = new PlayerInfo();

            pInfo.Name = e.User.IRCUser.Name;

            Players.Add(pInfo);

            if (sndJoinSound != null)
            {
                AudioMaster.PlaySound(sndJoinSound);
            }

            BroadcastOptions();
            CopyPlayerDataToUI();
        }
Beispiel #31
0
	void Awake()
	{
		if (instance == null)
		{
			instance = this;
			DontDestroyOnLoad(this.gameObject);
		}
		else
		{
			Destroy(this.gameObject);
		}

		theTransform = this.transform;

//		foreach (Transform t in theTransform)
//		{
//			if (t.gameObject.name == "MusicPlayer")
//			{
//				musicPlayer = t.gameObject.GetComponent<MusicPlayer>();
//			}
//		}
	}