示例#1
0
 void Start()
 {
     //Initializing the OnOpeningFinish -> It will call the function change color when the SoundClip named "Opening" reaches the end.
     OnAudioFinish = new SoundManagerEvent(NotifyOpening);
     //Play the sound and ask to be notified
     SoundManager.Instance.Play("Opening", OnAudioFinish);
 }
示例#2
0
 void Awake()
 {
     if (s_Instance == null)
     {
         s_Instance = this;
     }
     //DontDestroyOnLoad(this);
 }
示例#3
0
    void Start()
    {

        //Initializing the OnOpeningFinish -> It will call the function change color when the SoundClip named "Opening" reaches the end.
        OnAudioFinish = new SoundManagerEvent(NotifyOpening);
        //Play the sound and ask to be notified
        SoundManager.Instance.Play("Opening", OnAudioFinish);
    }
示例#4
0
 public void canon()
 {
     SoundManagerEvent.emit(SoundManagerType.INTERFACE, null);
     if (Artefact_Script.instance.X >= coutCanon)      //On vérifie si le joueur a suffisamment de X pour créer une tour
     {
         Artefact_Script.instance.DepenseX(coutCanon); //On enlève le coût de la Tour au total de X qu'a le joueur
         createTourCanon(1);                           //On lance la fonction de création de tour Canon de niveau 1
         //Destroy(this.gameObject);   //On détruit l'interface du menu car la tour est en cours de création
     }
 }
示例#5
0
 public void sniper()            //Se produit lorsqu'on clique sur le bouton de pose de tour Sniper
 {
     SoundManagerEvent.emit(SoundManagerType.INTERFACE, null);
     if (Artefact_Script.instance.X >= coutSniper)
     {
         Artefact_Script.instance.DepenseX(coutSniper); //On enlève le coût de la Tour au total de X qu'a le joueur
         createTourSniper(1);                           //On lance la fonction de création de tour Sniper de niveau 1
         //Destroy(this.gameObject);   //On détruit l'interface du menu car la tour est en cours de création
     }
 }
示例#6
0
    public void rafale()            //Se produit lorsqu'on clique sur le bouton de pose de tour Rafale
    {
        SoundManagerEvent.emit(SoundManagerType.INTERFACE, null);
        if (Artefact_Script.instance.X >= coutRafale)      //On vérifie si le joueur a suffisamment de X pour créer une tour
        {
            Artefact_Script.instance.DepenseX(coutRafale); //On enlève le coût de la Tour au total de X qu'a le joueur
            Debug.Log("shake your body");
            createTourRafale(1);                           //On lance la fonction de création de tour Rafale de niveau 1

            //Destroy(this.gameObject);   //On détruit l'interface du menu car la tour est en cours de création
        }
    }
示例#7
0
        /// <summary>
        /// Plays an audio clip given a reference to a AudioClip object
        /// </summary>
        /// <param name="clip">Reference to the AudioClip you want to play</param>
        public AudioSource Play(AudioClip clip, SoundManagerEvent callBack = null)
        {
            GameObject source = Instantiate(soundPrefab) as GameObject;
            Sound sound = source.GetComponent<Sound>();
            sound.OnStart += SoundManager_OnStart;
            sound.OnFinish += SoundManager_OnFinish;

            if (callBack != null)
            {
                sound.OnAudioFinish += callBack;
            }

            sound.SetSound(clip, volume);
            source.transform.parent = Instance.transform;
            sounds.Add(sound);
            return source.audio;
        }
示例#8
0
        /// <summary>
        /// Plays an audio clip given a reference to a AudioClip object
        /// </summary>
        /// <param name="clip">Reference to the AudioClip you want to play</param>
        public AudioSource Play(AudioClip clip, SoundManagerEvent callBack = null)
        {
            GameObject source = Instantiate(soundPrefab) as GameObject;
            Sound      sound  = source.GetComponent <Sound>();

            sound.OnStart  += SoundManager_OnStart;
            sound.OnFinish += SoundManager_OnFinish;

            if (callBack != null)
            {
                sound.OnAudioFinish += callBack;
            }

            sound.SetSound(clip, volume);
            source.transform.parent = Instance.transform;
            sounds.Add(sound);
            return(source.audio);
        }
示例#9
0
    void CreateParticule()
    {
        for (int i = 0; i < 360 / _particleByAngle; ++i)
        {
            GameObject lightParticule = Instantiate(_lightParticule);

            SetParticule(lightParticule, _particleByAngle + _particleByAngle * i + _offsetDegre);
        }

        if (tag == "Player")
        {
            SoundManagerEvent.Emit(7);
        }
        else
        {
            SoundManagerEvent.Emit(8);
        }
    }
示例#10
0
    void NextWave()
    {
        SoundManagerEvent.emit(SoundManagerType.NEWWAVE, null);
        GameObject spawner = null;

        spawner = null;
        foreach (GameObject go in vague)
        {
            spawner = (GameObject)Instantiate(go, transform.position, Quaternion.identity);
        }

        //On attribue le navmesh à l'ennemi créé
        NavMeshAgent nav_ennemy = spawner.GetComponent <NavMeshAgent>();

        nav_ennemy.destination = destination.position;

        spawner.GetComponent <Ennemy>().start = this.transform.position;
    }
示例#11
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player" || other.gameObject.tag == "Player2")
        {
            ParticleEmit p2 = other.gameObject.GetComponent <ParticleEmit>();
            _currontColor = p2.GetColor() + _colorBase;
            _fusion       = true;

            if (tag == "Player")
            {
                SoundManagerEvent.Emit(9);
            }

            if (gaMana.CurrentState == GameManager.GameStates.MainMenu)
            {
                gaMana.ShowCredit(true);
            }
        }
    }
示例#12
0
    void CheckGameState()
    {
        if (currentLevelNumber == 0)
        {
            currentState = GameStates.Intro;
        }
        else if (currentLevelNumber == 1)
        {
            currentState = GameStates.MainMenu;
        }
        else if (currentLevelNumber == 5)
        {
            currentState = GameStates.EndGame;
        }
        else
        {
            currentState = GameStates.InGame;
        }

        SoundManagerEvent.Emit(currentLevelNumber);
    }
示例#13
0
    public void checkFusionSup(Tour nouvelleTour, string typeDeTour, int level)                //On vérifie s'il est possible de fusionner une tour nouvelleTour avec des tours de son typeDeTour et de son Level
    {
        List <Tour> tourTrouves = new List <Tour>();                                           //Comme on va effectuer ce test pour chaque tour détectée pendant le test, on stocke chaque tour valide à la fusion dans une liste pour savoir combien de tours on doit supprimer à la fin du test

        tourTrouves.Add(nouvelleTour);                                                         //On commence par ajouter la tour qui vient d'être posée car c'est à partir de sa position que l'on teste si d'autres tours similaires sont présentes

        checkFusion(ref tourTrouves, place_script.xRow, place_script.yCol, typeDeTour, level); //On lance la fonction qui teste si des tours similaires sont présentes autour de la tour qui vient d'être posée

        if (tourTrouves.Count >= 3)                                                            //Si on a trouvé au moins 3 tours similaires alors on peut effectuer une fusion
        {
            Debug.Log("tour Fusionnée !");
            foreach (Tour tour in tourTrouves)           //Pour chaque tour que l'on a trouvé, on effectue une action
            {
                if (tour.place_tour != null)
                {
                    tour.place_tour.GetComponent <Place>().libre = true;    //La place sur laquelle était posée la tour redevient vide
                    SoundManagerEvent.emit(SoundManagerType.FUSION, null);
                }



                DestroyImmediate(tour.gameObject);      //On détruit immédiatement (pour ne pas gêner la détection des autres tours) chaque tour trouvée lors du test de fusion
            }
            level++;                                    //On incrémente le niveau de la tour qui a été posée (puis détruite) pour en créer une autre de niveau supérieur
            switch (typeDeTour)                         //On crée une nouvelle tour d'un type correspondant aux tours fusionnées qui ont été détruites
            {
            case "sniper":                              //Si la tour était du type Sniper, on lance la fonction de création de tour avec cette fois-ci un niveau supplémentaire
                createTourSniper(level);
                break;

            case "rafale":
                createTourRafale(level);
                break;

            case "canon":
                createTourCanon(level);
                break;
            }
        }
    }
示例#14
0
    public void checkFusionSupL(Tour nouvelleTour, int level)                       //On vérifie s'il est possible de fusionner une tour nouvelleTour avec des tours de son typeDeTour et de son Level
    {
        List <Tour> tourTrouves = new List <Tour>();                                //Comme on va effectuer ce test pour chaque tour détectée pendant le test, on stocke chaque tour valide à la fusion dans une liste pour savoir combien de tours on doit supprimer à la fin du test

        tourTrouves.Add(nouvelleTour);                                              //On commence par ajouter la tour qui vient d'être posée car c'est à partir de sa position que l'on teste si d'autres tours similaires sont présentes

        checkFusionL(ref tourTrouves, place_script.xRow, place_script.yCol, level); //On lance la fonction qui teste si des tours similaires sont présentes autour de la tour qui vient d'être posée

        if (tourTrouves.Count >= 3)                                                 //Si on a trouvé au moins 3 tours similaires alors on peut effectuer une fusion
        {
            Debug.Log("tour L CREEE !");
            foreach (Tour tour in tourTrouves)           //Pour chaque tour que l'on a trouvé, on effectue une action
            {
                if (tour.place_tour != null)
                {
                    tour.place_tour.GetComponent <Place>().libre = true;    //La place sur laquelle était posée la tour redevient vide
                    SoundManagerEvent.emit(SoundManagerType.FUSION, null);
                }
                DestroyImmediate(tour.gameObject);      //On détruit immédiatement (pour ne pas gêner la détection des autres tours) chaque tour trouvée lors du test de fusion
            }
            createTourL();
        }
    }
示例#15
0
        /// <summary>
        /// Plays an AudioClip given a sound clip name.
        /// </summary>
        /// <param name="soundName">Name of the sound clip. It must be the same in the XML songs.xml</param>
        public AudioSource Play(string soundName, SoundManagerEvent callBack = null)
        {
            string path = "";

            try
            {
                path = GetXMLSoundByName(soundName).path;
            }
            catch (NullReferenceException exception)
            {
                Debug.LogWarning("There is no " + soundName + " in your xml file. " + exception);
            }

            AudioClip clip = Resources.Load <AudioClip>(path);

            if (clip == null)
            {
                Debug.LogWarning("Sound Clip " + soundName + " was not found at  " + path);
                return(null);
            }

            return(Play(clip, callBack));
        }
示例#16
0
    public void createTourL()         //Cette fonction permet de créer une tour L d'un niveau dépendant de s'il y a eu une fusion avant son exécution ou non.
    {
        SoundManagerEvent.emit(SoundManagerType.FUSION, null);
        Debug.Log("fusion IMBA");
        cible_script = (MainCanvas)transform.parent.gameObject.GetComponent(typeof(MainCanvas));
        GameObject nouvelleTour_L = Instantiate(tour_L) as GameObject;                                                                                       //On crée la tour L contenue dans le tableau à la case level-1 (pour correspondre au tableau qui commence à 0)

        nouvelleTour_L.transform.position = new Vector3(cible_script.Place_click.transform.position.x, 2.5f, cible_script.Place_click.transform.position.z); //On place la tour aux coordonnées de la tuile cliquée

        Tour nouvelleTour = nouvelleTour_L.GetComponent <Tour>();                                                                                            //On crée un gameobject dans lequel on met la tour que l'on a crée juste avant

        nouvelleTour.panelAmelio = UIamelio;
        nouvelleTour.type        = "L";                                            //On attribue le type Sniper à la tour que l'on vient de créer
        place_script.creation_script.plateauTour[place_script.xRow, place_script.yCol] = nouvelleTour;
        //On accède au script de la tuile PUIS au script de la création du plateau (où sont les variables de positions des tuiles et des tours) PUIS à la position des tours pour attribuer les coordonnées de la nouvelle tour

        /*if (!(level >= 3))          //Si le niveau de la tour créée n'est pas supérieur ou égal au niveau maximum alors on vérifie si une fusion est possible
         * {
         *  checkFusionSup(nouvelleTour, "L", level);      //On vérifie si une fusion est possible à partir de la nouvelle tour avec des tours de son type et de son niveau
         * }*/

        this.gameObject.SetActive(false);   //Désactive le panel après que tous les tests de fusion aient été effectués
    }
示例#17
0
    // Update is called once per frame

    void Update()
    {
        if (gaMana.CurrentState != GameManager.GameStates.Pause || _activeInPause)
        {
            InputDetection();
            m_MovementAxis         = new Vector3(m_XInput, -m_YInput, 0.0f);
            m_ParticleMovementAxis = new Vector3(m_RXInput, -m_RYInput, 0.0f);

            _time += Time.deltaTime;
            if (_time >= _impulseByTime && m_PlayerId == 1)
            {
                float dist = Vector2.Distance(transform.position, _otherPlayer.transform.position);

                SoundManagerEvent.Instance.Volume(0, 1 - dist / 14);
                SoundManagerEvent.Emit(6);
                _time = 0f;
            }
        }
        else
        {
            m_MovementAxis         = new Vector3(0f, 0f, 0.0f);
            m_ParticleMovementAxis = new Vector3(0, 0, 0.0f);
        }
    }
示例#18
0
    IEnumerator attack()
    {
        while (file.Count > 0) //Tant que la cible est toujours dans la liste
        {
            if (file[0] != null)
            {
                prefab_tir_script = (Tir)prefab_tir.GetComponent(typeof(Tir));

                //Le projectile vise l'ennemie numero 1 (en position zéro dans la liste)
                prefab_tir_script.cible = file[0].gameObject;

                //Le projectile de la TOUR CANON vise l'ennemie numero 1 (en position zéro dans la liste) S'IL n'as pas déjà une destination
                if (prefab_tir_script.GetDestination == false)
                {
                    prefab_tir_script.cibleTirCanon = file[0].transform.position;
                }

                //La tour tir un nouveau projectile
                //Vector3 pos = new Vector3(transform.position.x + Random.Range(-1, 1), transform.position.y + Random.Range(1, 3), transform.position.z);
                //Instantiate(prefab_tir, pos, transform.rotation);



                if (IsPoison)
                {
                    prefab_tir_script.IsPoison = true;
                }
                if (IsGel)
                {
                    prefab_tir_script.IsGel = true;
                }
                if (IsRadiation)
                {
                    prefab_tir_script.IsRadiation = true;
                }

                Instantiate(prefab_tir, transform.position, transform.rotation);
                switch (type)
                {
                case "rafale":
                    SoundManagerEvent.emit(SoundManagerType.RAFALE, this.gameObject);
                    break;

                case "sniper":
                    SoundManagerEvent.emit(SoundManagerType.SNIPER, this.gameObject);
                    break;

                case "canon":
                    SoundManagerEvent.emit(SoundManagerType.CANON, this.gameObject);
                    break;
                }



                tir_instance = Instantiate(prefab_tir, transform.position, transform.rotation) as GameObject;
                if (IsPoison)
                {
                    tir_instance.GetComponent <Tir>().IsPoison = true;
                }
                if (IsGel)
                {
                    tir_instance.GetComponent <Tir>().IsGel = true;
                }
                if (IsRadiation)
                {
                    tir_instance.GetComponent <Tir>().IsRadiation = true;
                }
                //Maintenant on attend le couldown avant de relancer un projectile
                yield return(new WaitForSeconds(cooldown));
            }
            else
            {
                break;
            }
        }

        if (file.Count > 0) //Si il y a des éléments dans le tableau
        {
            //Normalement à ce stade la cible est morte, juste pour vérifier on fait ce if
            if (file[0] == null) //Si il y n'y a pas d'élément en 1ère position on refresh la liste pour en trouver un
            {
                refresh();
            }
        }
        else if (file.Count == 0) //Si il n'y a plus de cible après celle qui vient de disparaître
        {
            //Alors on indique à la tour qu'elle est à nouveau prête à tirer
            mode_attaque = false;

            //On efface la dernière cible, elle est loin ou détruite
            prefab_tir_script.cible = null;
        }
        yield return(null);
    }
 void Awake()
 {
     if (s_Instance == null)
         s_Instance = this;
     //DontDestroyOnLoad(this);
 }
示例#20
0
 public void launchNextWave()
 {
     SoundManagerEvent.emit(SoundManagerType.INTERFACE, null);
     Artefact_Script.instance.GainY((int)timeBeforeNextWave);
     timeBeforeNextWave = 0;
 }
示例#21
0
    public GameObject tour_touch;           //On accède à la Tour touchée

    public void quitter()
    {
        SoundManagerEvent.emit(SoundManagerType.INTERFACE, null);
        place_touch.GetComponent <Place>().libre = true;
        this.gameObject.SetActive(false);
    }
示例#22
0
        /// <summary>
        /// Plays an AudioClip given a sound clip name.
        /// </summary>
        /// <param name="soundName">Name of the sound clip. It must be the same in the XML songs.xml</param>
        public AudioSource Play(string soundName, SoundManagerEvent callBack = null)
        {
            string path = "";
            try
            {
                path = GetXMLSoundByName(soundName).path;
            }
            catch (NullReferenceException exception)
            {
                Debug.LogWarning("There is no " + soundName + " in your xml file. " + exception);
            }

            AudioClip clip = Resources.Load<AudioClip>(path);

            if (clip == null)
            {
                Debug.LogWarning("Sound Clip " + soundName + " was not found at  " + path);
                return null;
            }

            return Play(clip, callBack);
        }