// Start is called before the first frame update
    void Start()
    {
        msgMap = new Dictionary <MessageSender, GameObject>
        {
            { MessageSender.ANNA, sendMessageUI },
            { MessageSender.JESSICA, receiveMessageUI },
            { MessageSender.DAD, receiveMessageUI },
            { MessageSender.OTHER, receiveMessageUI },
        };

        initialMap = new Dictionary <MessageSender, string>
        {
            { MessageSender.ANNA, "A" },
            { MessageSender.JESSICA, "J" },
            { MessageSender.DAD, "D" },
            { MessageSender.OTHER, "?" },
        };

        ServiceLocator.Current.Get <GameLoopManager>().OnLevelReady += OnLevelReady;
        msgMan = ServiceLocator.Current.Get <TextMessageManager>();

        if (msgMan.LevelTextMessages.ContainsKey(SceneManager.GetActiveScene().name))
        {
            messageBuffer = msgMan.LevelTextMessages[SceneManager.GetActiveScene().name];
        }
        else
        {
            return;
        }

        msgTime = messageBuffer[currentMsg].MessageText.Length * msgTimeMultiplier;
    }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        msgMap = new Dictionary <MessageSender, GameObject>
        {
            { MessageSender.ANNA, sendMessageUI },
            { MessageSender.JESSICA, receiveMessageUI },
            { MessageSender.DAD, receiveMessageUI },
            { MessageSender.OTHER, receiveMessageUI },
        };

        myRect         = GetComponent <RectTransform>();
        messageManager = ServiceLocator.Current.Get <TextMessageManager>();
        //messageManager.OnNewTextMessage += ShowNewMessage;

        foreach (KeyValuePair <string, TextMessage[]> kvp in messageManager.LevelTextMessages)
        {
            foreach (var msg in kvp.Value)
            {
                ShowNewMessage(msg);
            }
            if (kvp.Key == SceneManager.GetActiveScene().name)
            {
                break;
            }
        }
    }
 protected override void Awake()
 {
     base.Awake();
     if (lightAudioClip && lightAudioSource)
     {
         lightAudioSource.clip = lightAudioClip;
     }
     _textMessageManager = ServiceLocator.Current.Get <TextMessageManager>();
 }