public void ShowLocalNotification(WorldNotificationArgs worldNotificationArgs) { GameObject worldNotificationObj = Instantiate(worldNotificationPrefab); WorldNotification worldNotification = worldNotificationObj.GetComponent <WorldNotification>(); worldNotification.InitializeAndStart(worldNotificationArgs); }
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)); }
protected void Harvest(WorldNotification notification) { Debug.Log("Harvest"); if (fruit != null) { fruit.enabled = false; } StorageManager.Instance.AddStorageItem(Definition.Harvest, 1); }
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); }
protected void OnLifeCycleMature() { readyToHarvest = true; WorldNotification notification = NotificationManager.Instance.AddNotification(gameObject); notification.onPressComplete += Harvest; if (fruit != null) { fruit.enabled = true; } }
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); }
protected void OnNotificationActioned(WorldNotification notification) { Debug.Log("OnNotificationActioned"); RemoveNotification(notification.notifier); }