Beispiel #1
0
 void onItemCollected(ItemCollectedEvent itemCollected)
 {
     if (itemCollected.PlayerUpgrade.GetHealth() > 0)
     {
         float healthIncrease = playerHealth.GetTotalHealth() * itemCollected.PlayerUpgrade.GetHealth();
         updateHealthbar(playerHealth.GetCurrentHealth() + healthIncrease);
     }
 }
 void onItemCollected(ItemCollectedEvent itemCollected)
 {
     if (itemCollected.Item.Equals(gameObject))
     {
         Debug.LogFormat("Playing {0} collected sound", gameObject);
         audioSource.PlayOneShot(Clip, volume);
     }
 }
Beispiel #3
0
    private void Start()
    {
        this.itemCollectedEvent = new ItemCollectedEvent();
        EventManager.AddItemCollectedInvoker(this);

        this.powerUpEvent = new PowerUpEvent();
        EventManager.AddPowerUpInvoker(this);
    }
Beispiel #4
0
 // Start is called before the first frame update
 void Start()
 {
     // Event for HUI_CUI updating
     itemCollectedEvent = new ItemCollectedEvent();
     EventManager.AddItemCollectedInvoker(this);
     Pulse();
     sr         = GetComponent <SpriteRenderer>();
     itemToDrop = Random.Range(0, 9);
     DropItem(itemToDrop);
 }
Beispiel #5
0
 public void OnReceived(EBEvent e)
 {
     if (e.type == EBEventType.ItemCollected)
     {
         ItemCollectedEvent ice = e as ItemCollectedEvent;
         if (ice.item.GetItemType() == CollectibleItem.Type.Book)
         {
             StartCoroutine(ShowQuote());
         }
     }
 }
Beispiel #6
0
    void Start()
    {
        //Subscribing to GameEvents
        EntityHitEvent.Register(onEntityHit);
        ItemCollectedEvent.Register(onItemCollected);

        //Finding Player Oject
        playerObject = GameObject.FindGameObjectWithTag("Player");
        playerHealth = playerObject.GetComponent <HealthComponent>();

        //UI Slider
        ImageSlider.SetSliderValue(1);
    }
    private void ProcessItemCollectedEvent(ItemCollectedEvent e)
    {
        switch (e.item.GetItemType())
        {
        case CollectibleItem.Type.Book:
            interfaceSoundSource.PlayOneShot(grabBookSound);
            break;

        case CollectibleItem.Type.Key:
            interfaceSoundSource.PlayOneShot(grabKeySound);
            break;
        }
    }
Beispiel #8
0
    private void ProcessItemCollectedEvent(ItemCollectedEvent e)
    {
        switch (e.item.GetItemType())
        {
        case CollectibleItem.Type.Book:
            ++collectiblesFound_;
            AddMadness(MADNESS_PER_BOOK_COLLECTED);
            break;

        case CollectibleItem.Type.Key:
            keyFound_ = true;
            break;
        }
    }
    public void OnReceived(EBEvent e)
    {
        switch (e.type)
        {
        case EBEventType.RoomSpawningTrigger:
            if (attachedDoor == null || (e as RoomSpawningTriggerEvent).roomEntryId != attachedDoor.GetId())
            {
                translationEnabled = true;
            }
            break;

        case EBEventType.ItemCollected:
            ItemCollectedEvent ice = e as ItemCollectedEvent;
            if ((ice.item.GetItemType() == CollectibleItem.Type.Key) && (ice.item.GetRoomScene() == roomScene))
            {
                TranslateRoom();     // translate to ending scene
            }
            break;
        }
    }
Beispiel #10
0
 // Start is called before the first frame update
 void Start()
 {
     itemBoughtEvent = new ItemCollectedEvent();
     EventManager.AddItemBoughtInvoker(this);
     UpdateCountText();
 }
 // Use this for initialization
 void Start()
 {
     audioSource = GetComponent <AudioSource>();
     ItemCollectedEvent.Register(onItemCollected);
 }
Beispiel #12
0
 private void HandleItemCollected(ItemCollectedEvent collectedEvent)
 {
     Points += 10;
 }