Пример #1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            EventHeroDamaged data = new EventHeroDamaged(10, new Vector3(45, 45, 45));
            EventsManager.DispatchEvent(data);
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            EventHeroDead data = new EventHeroDead(10000, 2);
            EventsManager.DispatchEvent(data);
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            EventsManager.UnsubscribeToEvent <EventHeroDamaged>(HeroDamage);
        }

        if (Input.GetKeyDown(KeyCode.J))
        {
            EventsManager.UnsubscribeToEvent <EventHeroDead>(HeroDead);
        }
    }
Пример #2
0
 private void HeroDamage(EventHeroDamaged dataEvent)
 {
     Debug.Log("HeroDamage: " + dataEvent.damage);
     Debug.Log("HeroDamage: " + dataEvent.knockBack);
 }