Esempio n. 1
0
 private void StopSalsa()
 {
     if ((salsa2d != null) && (salsa2d.audioClip == clip))
     {
         salsa2d.Stop();
     }
     if ((salsa3d != null) && (salsa3d.audioClip == clip))
     {
         salsa3d.Stop();
     }
 }
        /// <summary>
        /// Draw the GUI buttons
        /// </summary>
        void OnGUI()
        {
            yPos = 0;             // Reset the button Y position

            #region Salsa2D Play, Pause, and Stop controls
            yPos += yGap;
            if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Play"))
            {
                salsa2D.Play();                 // Salsa3D Play method
            }

            yPos += (yGap + yHeight);
            if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Pause"))
            {
                salsa2D.Pause();                 // Salsa3D Pause method
            }

            yPos += (yGap + yHeight);
            if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Stop"))
            {
                salsa2D.Stop();                 // Salsa3D Stop method
            }
            #endregion

            #region Toggle which audio clip is set on Salsa2D
            yPos += (yGap + yHeight);
            if (GUI.Button(new Rect(20, yPos, xWidth, yHeight), "Set audio clip"))
            {
                if (clipIndex < audioClips.Length - 1)
                {
                    clipIndex++;
                    salsa2D.SetAudioClip(audioClips[clipIndex]);
                }
                else
                {
                    clipIndex = 0;
                    salsa2D.SetAudioClip(audioClips[clipIndex]);
                }
            }
            #endregion
            #region Display the currently selected audio clip
            GUI.Label(new Rect(30 + xWidth, yPos, xWidth, yHeight), "Clip " + audioClips[clipIndex].name);
            #endregion
        }
Esempio n. 3
0
        private bool showPlayerResponses = false; // Tracks the visible status of the player dialog text

        #endregion Fields

        #region Methods

        /// <summary>
        /// Reset the dialog system at runtime
        /// </summary>
        public void ResetDialog()
        {
            npcDialogIndexTracker = 0;
            endDialogNpc = false;
            endDialogPlayer = false;
            showNPCDialog = true;
            showPlayerResponses = false;

            this.salsaTypObj = GetSalsaType(npcDialog[npcDialogIndexTracker].npc);

            if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa3D)
            {
                salsa3D = this.salsaTypObj.salsaGameObject.GetComponent<Salsa3D>();
                salsa3D.Stop();
            }

            if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa2D)
            {
                salsa2D = this.salsaTypObj.salsaGameObject.GetComponent<Salsa2D>();
                salsa2D.Stop();
            }

            if (npcDialog[npcDialogIndexTracker].playerResponse.Length > 0)
            {
                this.salsaTypObj = GetSalsaType(npcDialog[npcDialogIndexTracker].playerResponse[0].player);

                if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa3D)
                {
                    salsa3D = this.salsaTypObj.salsaGameObject.GetComponent<Salsa3D>();
                    salsa3D.Stop();
                }

                if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa2D)
                {
                    salsa2D = this.salsaTypObj.salsaGameObject.GetComponent<Salsa2D>();
                    salsa2D.Stop();
                }
            }

            Start();
            showNPCDialog = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Reset the dialog system at runtime
        /// </summary>
        public void ResetDialog()
        {
            npcDialogIndexTracker = 0;
            endDialogNpc          = false;
            endDialogPlayer       = false;
            showNPCDialog         = true;
            showPlayerResponses   = false;

            this.salsaTypObj = GetSalsaType(npcDialog[npcDialogIndexTracker].npc);

            if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa3D)
            {
                salsa3D = this.salsaTypObj.salsaGameObject.GetComponent <Salsa3D>();
                salsa3D.Stop();
            }

            if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa2D)
            {
                salsa2D = this.salsaTypObj.salsaGameObject.GetComponent <Salsa2D>();
                salsa2D.Stop();
            }

            if (npcDialog[npcDialogIndexTracker].playerResponse.Length > 0)
            {
                this.salsaTypObj = GetSalsaType(npcDialog[npcDialogIndexTracker].playerResponse[0].player);

                if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa3D)
                {
                    salsa3D = this.salsaTypObj.salsaGameObject.GetComponent <Salsa3D>();
                    salsa3D.Stop();
                }

                if (this.salsaTypObj.salsaType == CM_SalsaTypeAndObject.SalsaTypeOf.Salsa2D)
                {
                    salsa2D = this.salsaTypObj.salsaGameObject.GetComponent <Salsa2D>();
                    salsa2D.Stop();
                }
            }

            Start();
            showNPCDialog = true;
        }