示例#1
0
    public void PushEvent(EventBase targetEvent) // Calls when ritual events created.
    {
        audioSource.Play(); // Notification sound

        World targetWorld = worldMgr.GetWorld(targetEvent.town);
  
        // Set notification message.
        string eventName = targetEvent.GetComponent<SpriteRenderer>().sprite.name;
        string message = "@god" + "  #" + eventName + "  #" + GetWorldName(targetWorld);

        Text newText = Instantiate(newsfeedTextPrefab).GetComponent<Text>();
        newText.transform.SetParent(this.transform, false);
        newText.transform.localPosition = new Vector2(200, -75);
        newText.text = message;
        messageQueue.Enqueue(new MessageInfo(newText.GetComponent<Text>(), 0));

        foreach (MessageInfo eachInfo in messageQueue)
        {
            StartCoroutine(MoveUpward(eachInfo.messageText)); // Move upward old messages.
        }
    }