Exemple #1
0
    void Awake()
    {
        if (instance == null) // se nao tem audio-manager vai instanciar esse mesmo
        {
            instance = this;
        }
        else // se ja tiver destroi o outro
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject); // forma de assegurar que o audio-manager nao sera destruido

        foreach (Sons s in trilha)     //criação de todos os sons
        {
            //caracteristicas do audios criados:

            s.fonte                       = gameObject.AddComponent <AudioSource>(); //audio source vai ser igual a um novo objeto
            s.fonte.clip                  = s.musics;                                //gera uma nova musica
            s.fonte.volume                = s.volume;                                //gera um novo controle de volume
            s.fonte.pitch                 = s.pitch;                                 // gera um novo controlador de pitch
            s.fonte.loop                  = s.loop;                                  // gera uma variavel para ver se o audio vai loopar
            s.fonte.playOnAwake           = s.awake;
            s.fonte.outputAudioMixerGroup = s.mixer;
        }
    }
Exemple #2
0
    void Awake()
    {
        DontDestroyOnLoad(gameObject);

        if (myInstance == null)
        {
            myInstance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }


        foreach (Sound s in mySounds)
        {
            s.mySource      = gameObject.AddComponent <AudioSource>();
            s.mySource.clip = s.myClip;

            s.mySource.volume = s.myVolume;
            s.mySource.pitch  = s.myPitch;
            s.mySource.loop   = s.myLoop;
        }
    }
    // Awake is called before Start and Start is called before the first frame update
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else
        {
            Destroy(gameObject);

            return;
        }

        DontDestroyOnLoad(gameObject);

        foreach (Sound S in Sounds)
        {
            S.Source = Audio_Sources.AddComponent <AudioSource> ();

            S.Source.clip   = S.clip;
            S.Source.volume = S.Volume;
            S.Source.pitch  = S.Pitch;
            S.Source.loop   = S.Loop;
        }
    }
    // Use this for initialization
    void Start()
    {
        rb        = GetComponent <Rigidbody2D>();
        curPlayer = GameObject.FindWithTag("Player");

        am = GameObject.FindGameObjectWithTag("AudioManager");

        audioManager = am.GetComponent <Audio_Manager>();


        if (nextAsteroid == null)
        {
            return;
        }

        if (curPlayer == null)
        {
            return;
        }

        sm = GameObject.FindGameObjectWithTag("ScoreManager");

        scoreManager = sm.GetComponent <playerScore>();

        mainCamera  = Camera.main;
        cameraShake = mainCamera.GetComponent <CameraShake>();

        rb.velocity = transform.right * speed * Time.deltaTime;
        rb.AddTorque(Random.Range(-5f, 5f));
    }
 void Start()
 {
     audio_manager    = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();
     scene_loader     = FindObjectOfType <Scene_Loader>().GetComponent <Scene_Loader>();
     score_ui_manager = FindObjectOfType <Score_UI_Manager>().GetComponent <Score_UI_Manager>();
     bottom_sprite    = GameObject.Find("Bottom Support").GetComponent <SpriteRenderer>();
 }
    // Use this for initialization
    void Start()
    {
        audioManager = GameObject.Find("Audio Manager").GetComponent <Audio_Manager>();

        switch (thisPlant)
        {
        case GameManager.ShopItems.BASIC:
            GetComponent <SpriteRenderer>().sprite = basicPlant;
            break;

        case GameManager.ShopItems.FIRE:
            GetComponent <SpriteRenderer>().sprite = firePlantLv3;
            break;

        case GameManager.ShopItems.ICE:
            GetComponent <SpriteRenderer>().sprite = icePlantLv3;
            break;

        case GameManager.ShopItems.VOID:
            GetComponent <SpriteRenderer>().sprite = voidPlantLv3;
            break;

        default:
            GetComponent <SpriteRenderer>().sprite = basicPlant;
            break;
        }

        spriteRender = GetComponent <SpriteRenderer>();
        startScale   = transform.localScale;
    }
Exemple #7
0
 void Awake()
 {
     instance = this;
     //Fetch the AudioSource from the GameObject
     source = GetComponent <AudioSource>();
     //Ensure the toggle is set to true for the music to play at start-up
     // m_Play = true;
 }
Exemple #8
0
    void Start()
    {
        audio_manager = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();

        current_sprite = GetComponent <SpriteRenderer>();

        score_ui_manager = FindObjectOfType <Score_UI_Manager>().GetComponent <Score_UI_Manager>();
    }
Exemple #9
0
 void Awake()
 {
     dm = GameObject.FindGameObjectWithTag("Dm");
     SetupSkills();
     audio_S = GetComponent<AudioSource>();
     am = dm.GetComponent<Audio_Manager>();
     anim = GetComponentInChildren<Animator>();
     pScript = GetComponent<Player>();
 }
Exemple #10
0
 //--- Unity Methods ---//
 private void Awake()
 {
     // Init the private variables
     m_shadowObject  = GetComponent <Shadow>();
     m_rectTransform = this.GetComponent <RectTransform>();
     m_baseRect      = m_rectTransform.rect;
     m_shadowHeight  = m_shadowObject.effectDistance.y;
     keyAudio        = GameObject.Find("AudioManager").GetComponent <Audio_Manager>();
 }
Exemple #11
0
    private void Awake()
    {
        DontDestroyOnLoad(this); //keeps the backing track playing if we restart the scene

        SharedInstance = this;

        if (playBackingTrackOnStart)
        {
            PlayBackingTrack(true);
        }
    }
    void Start()
    {
        audio_manager           = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();
        current_sprite          = GetComponent <SpriteRenderer>();
        level_10_game_mechanics = FindObjectOfType <Level_10_Game_Mechanics>();

        ball_pos         = FindObjectOfType <Ball>().GetComponent <Transform>();
        ball_rb          = FindObjectOfType <Ball>().GetComponent <Rigidbody2D>();
        block_extents    = GetComponent <BoxCollider2D>().bounds.extents.x;
        score_ui_manager = FindObjectOfType <Score_UI_Manager>().GetComponent <Score_UI_Manager>();
    }
Exemple #13
0
    public void AddPiece(GameObject socketObject)
    {
        //nick's code
        parentScript.pieceRigidBody.isKinematic = true;
        parentScript.pieceRigidBody.useGravity  = false;
        parentScript.pieceRigidBody.rotation    = socketObject.GetComponent <ArmChecker>().connectionPosition.transform.rotation;
        parentScript.pieceRigidBody.position    = socketObject.GetComponent <ArmChecker>().connectionPosition.transform.position;
        Audio_Manager.Play("Connection");

        localManager.AddPieceToGlobalManager(socketObject);
    }
 private void Awake()                                                                 //Runs before Start() method.
 {
     if (instance != null)
     {
         Debug.LogError("More than one AudioManager in the scene!");
     }
     else
     {
         instance = this;
     }
 }
Exemple #15
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one AudioManager in the scene");
     }
     else
     {
         instance = this;
     }
 }
Exemple #16
0
    // Use this for initialization
    void Start()
    {
        PlayerScore           = sm.GetComponent <playerScore>();
        rb                    = GetComponent <Rigidbody2D>();
        disablespriteRenderer = GetComponent <SpriteRenderer>();
        disableboxCollider    = GetComponent <BoxCollider2D>();
        disableShooting       = GetComponent <Shooting>();
        audioManager          = am.GetComponent <Audio_Manager>();

        mainCamera  = Camera.main;
        cameraShake = mainCamera.GetComponent <CameraShake>();
    }
Exemple #17
0
    public void AddPieceToGlobalManager(GameObject socketObject)
    {
        //tree stuff
        globalPartManager.AddPlayerPart(shape, color, socketObject, gameObject);

        //socket stuff
        SocketToggle(true);
        Audio_Manager.Play("Part_Connect");

        //connect to object
        AddToModel(socketLaser.previousCollider.gameObject);
    }
Exemple #18
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
 void Awake()
 {
     if (Audio_Manager.Manager != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Manager = GetComponent <Audio_Manager>();
         DontDestroyOnLoad(gameObject);
     }
 }
    void Start()
    {
        scene_loader  = FindObjectOfType <Scene_Loader>().GetComponent <Scene_Loader>();
        audio_manager = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();

        if (Scene_Loader.scene_index != 0 && Scene_Loader.scene_index != 1 && Scene_Loader.scene_index != 9)
        {
            scene_transition.SetBool("level_start", true);
            //    scene_transition.SetBool("level_over", false);
            StartCoroutine(Change_Transition_Color());
        }
    }
    void Start()
    {
        scene_loader = FindObjectOfType <Scene_Loader>().GetComponent <Scene_Loader>();

        audio_manager = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();

        if (Scene_Loader.scene_index == 1 || Scene_Loader.scene_index == 9)
        {
            StartCoroutine(Wait_Before_Destroy());
            //  scene_transition.SetBool("start_transition", true);
        }
    }
Exemple #22
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }                                          // Checks if there is already a Audio manager and removes it
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject); // Don't get rid of the audio manager when the scene changes
    }
Exemple #23
0
    public Sound[] sounds;                //An array of sounds which get set in the inspector

    void Awake()
    {
        instance = this;                                             //Set the instance to itself

        foreach (Sound s in instance.sounds)                         //For all the sounds,
        {
            s.source      = gameObject.AddComponent <AudioSource>(); //Set its audio source to a new source on this object
            s.source.clip = s.clip;                                  //Set the clip of the audio source

            s.source.volume = s.volume;
            s.source.loop   = s.loop;
        }
    }
Exemple #24
0
    void Start()
    {
        audio_manager  = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();
        current_sprite = GetComponent <SpriteRenderer>();

        if (Scene_Loader.scene_index == 11)
        {
            level_10_block_spawner = FindObjectOfType <Level_10_Spacial_block_spawn>().GetComponent <Level_10_Spacial_block_spawn>();
            score_ui_manager       = FindObjectOfType <Score_UI_Manager>().GetComponent <Score_UI_Manager>();
        }
        else
        {
            level_6_game_mechanics = FindObjectOfType <Level_6_Game_Mechanics>().GetComponent <Level_6_Game_Mechanics>();
        }
    }
    // Use this for initialization
    void Start()
    {
        audioManager = GameObject.Find("Audio Manager").GetComponent <Audio_Manager>();

        switch (thisType)
        {
        case AudioType.MUSIC:
            GetComponent <Slider>().value = audioManager.musicVolume;
            break;

        case AudioType.EFFECTS:
            GetComponent <Slider>().value = audioManager.effectVolume;
            break;
        }
    }
    // Use this for initialization
    void Start()
    {
        audioManager = GameObject.Find("Audio Manager").GetComponent <Audio_Manager>();
        GameManager.Instance.gameOver   = false;
        GameManager.Instance.money      = 200;
        GameManager.Instance.waterLevel = 100;

        if (playButton)
        {
            if ((Input.GetJoystickNames().Length > 0) && (Input.GetJoystickNames()[0] != ""))
            {
                playButton.Select();
            }
        }
    }
Exemple #27
0
    // Start is called before the first frame update
    private void Awake()
    {
        //Make it persistent, load from scene to scene
        if (m_instance != null && m_instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            m_instance = this;
            DontDestroyOnLoad(this.gameObject);
        }

        //play music
        PlaySound();
    }
Exemple #28
0
    public void ButtonPress()
    {
        if (buttonDone) //how interact with apk
        {
            Audio_Manager.Play("Button");
            thisAnimator.SetBool("Pressed", true);
            buttonDone = false;

            //maybe add a delay?
            partManager.NonCoreRemovePart();
            partParent.transform.position = partParentLocation.transform.position;

            StartCoroutine(crateManager.CrateCycle());
            //create parts is in crate manager as it manages the transition
        } //else play unsuccessful press sound
    }
    void Start()
    {
        // taking references.
        scene_loader  = FindObjectOfType <Scene_Loader>();
        rb_ball       = GetComponent <Rigidbody2D>();
        player_pos    = FindObjectOfType <Touch_Control_Script>().transform;
        audio_manager = FindObjectOfType <Audio_Manager>().GetComponent <Audio_Manager>();



        if (Scene_Loader.scene_index != 15 && Scene_Loader.scene_index != 16 && Scene_Loader.scene_index != 17 && Scene_Loader.scene_index != 21)
        {
            score_manager = GameObject.Find("Score_UI_Manager").GetComponent <Score_UI_Manager>();
        }

        // ball_to_player_vector helps in attaching the ball with the paddle before launching it.
        player_to_ball_vector = transform.position - player_pos.position;
    }
    public void UpdateCallState()
    {
        // Grab the first caller's room so we can see if everyone else is there too
        Room_Name firstCallerRoom = m_callParticipants[0].CurrentRoom;

        // We need to check if it's ONLY this call group in this room. There shouldn't be another group in here
        if (m_roomManager.GetCurrentCapacity(firstCallerRoom) != m_numParticipants)
        {
            m_callState = Call_State.Waiting;
            return;
        }

        // Check in with the individual callers and see if they are in the same room
        foreach (var caller in m_callParticipants)
        {
            // If one of the participants is not in the same room, this call is in a waiting state by default
            if (firstCallerRoom != caller.CurrentRoom)
            {
                m_callState = Call_State.Waiting;
                return;
            }
        }

        // If all of the callers are in the same room, we still need to determine if they are actually in a chat room
        // If they are not in a chat room but they are all together, they are still waiting
        if (firstCallerRoom >= Room_Name.Chat_1 && firstCallerRoom <= Room_Name.Chat_5)
        {
            m_callState = Call_State.Active;
            if (prevState == Call_State.Waiting)
            {
                if (audioManager == null)
                {
                    audioManager = GameObject.Find("AudioManager").GetComponent <Audio_Manager>();
                }
                audioManager.PlayOneShot(2, 0.5f);
            }
            prevState = m_callState;
        }
        else
        {
            m_callState = Call_State.Waiting;
            prevState   = m_callState;
        }
    }
Exemple #31
0
    //--- Unity Methods ---//
    private void Awake()
    {
        // Init the private variables
        m_roomManager  = GameObject.FindObjectOfType <Room_Manager>();
        m_callLogUI    = GameObject.FindObjectOfType <CallerLog_UIManager>();
        m_callList     = new List <Call_Group>();
        totalCash      = GameObject.Find("Txt_Money").GetComponent <TextMeshProUGUI>();
        audioManager   = GameObject.Find("AudioManager").GetComponent <Audio_Manager>();
        persistManager = GameObject.Find("PersistenceManager").GetComponent <Persistence_Manager>();
        m_active       = false;

        // Sample the difficulty curve to determine how quickly calls should spawn throughout this day
        Persistence_Manager persistence = GameObject.FindObjectOfType <Persistence_Manager>();
        Day_Manager         dayManager  = GameObject.FindObjectOfType <Day_Manager>();
        float percentThroughWeek        = (float)persistence.m_dayNumber / (float)(dayManager.maxDayCounter - 1);

        m_timeBetweenCalls  = m_timeBetweenCallsCurve.Evaluate(percentThroughWeek);
        m_timeSinceLastCall = m_timeBetweenCalls;
        Debug.Log("Time Between Calls: " + m_timeBetweenCalls);
    }
Exemple #32
0
 void Start()
 {
     pCol = GetComponent<SphereCollider>();
     SwitchOff = false;
     keyCount = 0;
     dashed = false;
     anim = GetComponentInChildren<Animator>();
     maxHP = HP;
     dashForce = 2000;
     dmObject = GameObject.FindGameObjectWithTag("Dm");
     dm = dmObject.GetComponent<Dungeon_Manager>();
     am = dmObject.GetComponent<Audio_Manager>();
     audio_S = GetComponent<AudioSource>();
     UIS = GameObject.FindGameObjectWithTag("Main Canvas").GetComponent<UIscript>();
     rig = GetComponent<Rigidbody>();
 }
Exemple #33
0
 void Start()
 {
     startPos = transform.position;
     curHP = maxHP;
     dm = GameObject.FindGameObjectWithTag("Dm");
     audio_S = GetComponent<AudioSource>();
     lm = dm.GetComponent<Loot_Manager>();
     am = dm.GetComponent<Audio_Manager>();
     playerAmount = PlayerPrefs.GetInt("Players");
 }