Ejemplo n.º 1
0
    private void ShowNotification(string text, bool local, NotificationType type)
    {
        Transform spawn = local ? localNotificationSpawn : notificationSpawn;

        Notification newNotification = ObjectPooler.instance.GrabFromPool("Notification", spawn.position, Quaternion.identity).GetComponent <Notification>();

        newNotification.transform.SetParent(spawn);
        newNotification.Initialise(text);

        // Play audio here.
        switch (type)
        {
        case NotificationType.Default:
            break;

        case NotificationType.MarkCaptured:
            audioManager.PlayClipOnce(audioManager.GetClip("mark_captured"));
            break;

        case NotificationType.MarkGained:
            audioManager.PlayClipOnce(audioManager.GetClip("mark_claimed"));
            break;

        case NotificationType.MarkDestroyed:
            audioManager.PlayClipOnce(audioManager.GetClip("mark_destroyed"));
            break;

        case NotificationType.KillStreak:
            audioManager.PlayClipOnce(audioManager.GetClip("killingspree"));
            break;

        case NotificationType.JoinedGame:
            audioManager.PlayClipOnce(audioManager.GetClip("joined_game"));
            break;

        case NotificationType.LeftGame:
            audioManager.PlayClipOnce(audioManager.GetClip("left_game"));
            break;
        }
    }