Ejemplo n.º 1
0
    public void ShowLocalNotification(WorldNotificationArgs worldNotificationArgs)
    {
        GameObject        worldNotificationObj = Instantiate(worldNotificationPrefab);
        WorldNotification worldNotification    = worldNotificationObj.GetComponent <WorldNotification>();

        worldNotification.InitializeAndStart(worldNotificationArgs);
    }
Ejemplo n.º 2
0
    private void CreateNotification(Vector3 position, string text, float duration, string color)
    {
        GameObject        worldNotificationObj = Instantiate(worldNotificationPrefab);
        WorldNotification worldNotification    = worldNotificationObj.GetComponent <WorldNotification>();

        worldNotification.InitializeAndStart(new WorldNotificationArgs(position, text, duration, color));
    }
Ejemplo n.º 3
0
    protected void Harvest(WorldNotification notification)
    {
        Debug.Log("Harvest");
        if (fruit != null)
        {
            fruit.enabled = false;
        }

        StorageManager.Instance.AddStorageItem(Definition.Harvest, 1);
    }
Ejemplo n.º 4
0
    protected WorldNotification CreateNotification(Transform transform)
    {
        WorldNotification notification = Instantiate(Load(), this.transform);

        Vector3 pos = transform.position;

        pos.y += 1.5f;

        notification.transform.position = pos;

        return(notification);
    }
Ejemplo n.º 5
0
    protected void OnLifeCycleMature()
    {
        readyToHarvest = true;
        WorldNotification notification = NotificationManager.Instance.AddNotification(gameObject);

        notification.onPressComplete += Harvest;

        if (fruit != null)
        {
            fruit.enabled = true;
        }
    }
Ejemplo n.º 6
0
    public WorldNotification AddNotification(GameObject gameObject)
    {
        if (!worldNotifications.TryGetValue(gameObject, out WorldNotification notification))
        {
            WorldNotification worldNotification = CreateNotification(gameObject.transform);
            worldNotification.notifier            = gameObject;
            worldNotification.onNotificationDone += OnNotificationActioned;

            worldNotifications.Add(gameObject, worldNotification);

            return(worldNotification);
        }

        return(null);
    }
Ejemplo n.º 7
0
 protected void OnNotificationActioned(WorldNotification notification)
 {
     Debug.Log("OnNotificationActioned");
     RemoveNotification(notification.notifier);
 }