protected void ApplyRenderData(Char character, NPCData npcData)
        {
            character.lockDirection = npcData.lockDirection;
            character.lockScale     = npcData.lockScale;
            if (character.spriteChild && character.spriteChild.GetComponent <FollowSortingMap>())
            {
                character.spriteChild.GetComponent <FollowSortingMap>().lockSorting = npcData.lockSorting;
            }
            else if (character.GetComponent <FollowSortingMap>())
            {
                character.GetComponent <FollowSortingMap>().lockSorting = npcData.lockSorting;
            }
            else
            {
                character.ReleaseSorting();
            }

            if (npcData.lockDirection)
            {
                character.spriteDirection = npcData.spriteDirection;
            }
            if (npcData.lockScale)
            {
                character.spriteScale = npcData.spriteScale;
            }
            if (npcData.lockSorting)
            {
                if (character.spriteChild && character.spriteChild.GetComponent <Renderer>())
                {
                    character.spriteChild.GetComponent <Renderer>().sortingOrder     = npcData.sortingOrder;
                    character.spriteChild.GetComponent <Renderer>().sortingLayerName = npcData.sortingLayer;
                }
                else if (character.GetComponent <Renderer>())
                {
                    character.GetComponent <Renderer>().sortingOrder     = npcData.sortingOrder;
                    character.GetComponent <Renderer>().sortingLayerName = npcData.sortingLayer;
                }
            }

            if (character.GetComponentsInChildren <FollowSortingMap>() != null)
            {
                FollowSortingMap[] followSortingMaps = character.GetComponentsInChildren <FollowSortingMap>();
                SortingMap         customSortingMap  = Serializer.returnComponent <SortingMap> (npcData.customSortingMapID);

                foreach (FollowSortingMap followSortingMap in followSortingMaps)
                {
                    followSortingMap.followSortingMap = npcData.followSortingMap;
                    if (!npcData.followSortingMap && customSortingMap != null)
                    {
                        followSortingMap.SetSortingMap(customSortingMap);
                    }
                    else
                    {
                        followSortingMap.SetSortingMap(KickStarter.sceneSettings.sortingMap);
                    }
                }
            }
        }
Beispiel #2
0
        public static void Play(Char speaker, int lineID, string language)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            if (lineID > -1 && speaker != null && KickStarter.speechManager.searchAudioFiles)
            {
                LipSyncData lipSyncData = (LipSyncData)KickStarter.runtimeLanguages.GetSpeechLipsyncFile <LipSyncData> (lineID, speaker);

                if (lipSyncData != null)
                {
                    LipSync[] lipSyncs = speaker.GetComponentsInChildren <LipSync>();
                    if (lipSyncs != null && lipSyncs.Length > 0)
                    {
                        foreach (LipSync lipSync in lipSyncs)
                        {
                            if (lipSync != null && lipSync.enabled)
                            {
                                lipSync.Play(lipSyncData);
                            }
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif
        }
Beispiel #3
0
        public static void Stop(Char speaker)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            RogoDigital.Lipsync.LipSync[] lipSyncs = speaker.GetComponentsInChildren <RogoDigital.Lipsync.LipSync>();
            if (lipSyncs != null && lipSyncs.Length > 0)
            {
                foreach (RogoDigital.Lipsync.LipSync lipSync in lipSyncs)
                {
                    if (lipSync != null && lipSync.enabled)
                    {
                        lipSync.Stop(true);
                    }
                }
            }
                        #endif
        }
        protected void Visible(string text)
        {
            String[] components = text.Split(',');
            bool     state      = SetBoolean(components[1].Trim().ToLower());

            foreach (GameObject obj in objects)
            {
                if (obj.name.ToLower() == components[0].Trim().ToLower())
                {
                    if (obj.GetComponent <Renderer>())
                    {
                        obj.GetComponent <Renderer>().enabled = state;
                    }
                    foreach (Renderer _renderer in obj.GetComponentsInChildren <Renderer>())
                    {
                        _renderer.enabled = state;
                    }
                    return;
                }
            }

            Char actor = GetActorFrom(components[0]);

            if (actor != null)
            {
                if (actor.name.ToLower() == components[0].Trim().ToLower())
                {
                    if (actor.GetComponent <Renderer>())
                    {
                        actor.GetComponent <Renderer>().enabled = state;
                    }
                    foreach (Renderer _renderer in actor.GetComponentsInChildren <Renderer>())
                    {
                        _renderer.enabled = state;
                    }
                }
            }
        }
Beispiel #5
0
        public static void Play(Char speaker, string speakerName, int lineNumber, string language)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            if (lineNumber > -1 && speakerName != "" && KickStarter.speechManager.searchAudioFiles)
            {
                RogoDigital.Lipsync.LipSyncData lipSyncData = null;

                if (KickStarter.speechManager.autoNameSpeechFiles)
                {
                    string filename = "Lipsync/";
                    if (KickStarter.speechManager.placeAudioInSubfolders)
                    {
                        filename += speakerName + "/";
                    }
                    if (language != "" && KickStarter.speechManager.translateAudio)
                    {
                        // Not in original language
                        filename += language + "/";
                    }
                    filename += speakerName + lineNumber;

                    lipSyncData = Resources.Load(filename) as RogoDigital.Lipsync.LipSyncData;

                    if (lipSyncData == null)
                    {
                        ACDebug.LogWarning("No lipsync file found.  Looking for 'Resources/" + filename + "'");
                    }
                }
                else
                {
                    Object _object = KickStarter.speechManager.GetLineCustomLipsyncFile(lineNumber, Options.GetLanguage());
                    if (_object is RogoDigital.Lipsync.LipSyncData)
                    {
                        lipSyncData = (RogoDigital.Lipsync.LipSyncData)_object;
                    }
                }

                if (lipSyncData != null)
                {
                    RogoDigital.Lipsync.LipSync[] lipSyncs = speaker.GetComponentsInChildren <RogoDigital.Lipsync.LipSync>();
                    if (lipSyncs != null && lipSyncs.Length > 0)
                    {
                        foreach (RogoDigital.Lipsync.LipSync lipSync in lipSyncs)
                        {
                            if (lipSync != null && lipSync.enabled)
                            {
                                lipSync.Play(lipSyncData);
                            }
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
                else
                {
                    ACDebug.LogWarning("No LipSync data found for " + speaker.gameObject.name + ", line ID " + lineNumber);
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif
        }
        public static void Play(Char speaker, int lineID, string language)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            if (lineID > -1 && speaker != null && KickStarter.speechManager.searchAudioFiles)
            {
                RogoDigital.Lipsync.LipSyncData lipSyncData = null;

                if (KickStarter.speechManager.autoNameSpeechFiles)
                {
                    string fullName = KickStarter.speechManager.GetAutoAssetPathAndName(lineID, speaker, language, true);
                    lipSyncData = Resources.Load(fullName) as RogoDigital.Lipsync.LipSyncData;

                    if (lipSyncData == null && KickStarter.speechManager.fallbackAudio && Options.GetLanguage() > 0)
                    {
                        fullName    = KickStarter.speechManager.GetAutoAssetPathAndName(lineID, speaker, string.Empty, true);
                        lipSyncData = Resources.Load(fullName) as RogoDigital.Lipsync.LipSyncData;
                    }

                    if (lipSyncData == null)
                    {
                        ACDebug.LogWarning("Lipsync file 'Resources/" + fullName + "' not found.");
                    }
                }
                else
                {
                    Object _object = KickStarter.runtimeLanguages.GetLineCustomLipsyncFile(lineID, Options.GetLanguage());
                    if (_object is RogoDigital.Lipsync.LipSyncData)
                    {
                        lipSyncData = (RogoDigital.Lipsync.LipSyncData)_object;
                    }

                    if (lipSyncData == null)
                    {
                        ACDebug.LogWarning("No LipSync data found for " + speaker.gameObject.name + ", line ID " + lineID);
                    }
                }

                if (lipSyncData != null)
                {
                    RogoDigital.Lipsync.LipSync[] lipSyncs = speaker.GetComponentsInChildren <RogoDigital.Lipsync.LipSync>();
                    if (lipSyncs != null && lipSyncs.Length > 0)
                    {
                        foreach (RogoDigital.Lipsync.LipSync lipSync in lipSyncs)
                        {
                            if (lipSync != null && lipSync.enabled)
                            {
                                lipSync.Play(lipSyncData);
                            }
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif
        }