Пример #1
0
 public void Open()
 {
     renderer.sprite = open;
     if (!isOpen)
     {
         GoblinLootCoordinator.IncreaseLoot(1);
         EventCoordinator.TriggerEvent(EventName.System.Economy.ChestWasOpened(), GameMessage.Write().WithChest(this));
         EventCoordinator.TriggerEvent(EventName.System.Economy.AmountLootedChanged(), GameMessage.Write().WithIntMessage(GoblinLootCoordinator.GetLootAmount()));
     }
     isOpen = true;
 }
Пример #2
0
 void OnLootThrow(GameMessage msg)
 {
     if (GoblinLootCoordinator.HasLoot())
     {
         GameObject newThrown = Instantiate(lootPrefab);
         newThrown.transform.position = msg.coordinates;
         newThrown.GetComponent <LootFly>().ThrowAt(msg.targetCoordinates);
         GoblinLootCoordinator.DecreaseLoot(1);
         //Debug.Log("target coords: " + msg.targetCoordinates);
         newThrown.GetComponentInChildren <SpriteRenderer>().sprite = itemSprites[Random.Range(0, itemSprites.Count)];
         newThrown.transform.parent = GoblinLootCoordinator.Instance.transform;
         EventCoordinator.TriggerEvent(EventName.System.Economy.AmountLootedChanged(), GameMessage.Write().WithIntMessage(GoblinLootCoordinator.GetLootAmount()));
     }
 }
Пример #3
0
 void AmountLootedChanged(GameMessage msg)
 {
     text.text = "X" + GoblinLootCoordinator.GetLootAmount();
 }