Esempio n. 1
0
    void OnEnable()
    {
        OnEnableQuest();
        EventStartQuest ev = new EventStartQuest(quest_type);

        EventManager.Instance.SendEvent(ev);
    }
    public void OnEvent(GameEvent ev)
    {
        switch (ev.Type())
        {
        case GameEventType.EVENT_START_QUEST:
        {
            EventStartQuest start = (EventStartQuest)ev;

            if (start.quest == QuestType.QT_HIDDEN)
            {
                hidden_items = true;
                HiddeItems();
            }
            break;
        }

        case GameEventType.EVENT_END_QUEST:
        {
            EventEndQuest end = (EventEndQuest)ev;

            if (end.quest == QuestType.QT_HIDDEN)
            {
                hidden_items = false;
                ShowItems();
            }
            break;
        }

        default:
            break;
        }
    }
    void OnEvent(GameEvent ev)
    {
        switch (ev.Type())
        {
        case GameEventType.EVENT_START_QUEST:
        {
            EventStartQuest start = (EventStartQuest)ev;

            if (start.quest == QuestType.QT_GUNS)
            {
                force_gun = true;
            }
            if (start.quest == QuestType.QT_LACAJA && LaCaja_spawn)
            {
                if (spawned_item != null)
                {
                    ItemManager.Instance.RemoveFromitemsInstances(spawned_item);
                    GameObject.Destroy(spawned_item);
                }
                SpawnLACAJA();
            }
            break;
        }

        case GameEventType.EVENT_END_QUEST:
        {
            EventEndQuest start = (EventEndQuest)ev;

            if (start.quest == QuestType.QT_GUNS)
            {
                force_gun = false;
            }
            break;
        }

        case GameEventType.EVENT_MATCH_START:
        {
            SpawnItem();
            timer.Start();

            break;
        }

        case GameEventType.EVENT_ITEM_GRABBED: {
            EventItemGrabbed grab = (EventItemGrabbed)ev;
            if (grab.item == spawned_item)
            {
                spawned_item = null;
            }

            break;
        }

        default:
            Debug.LogError("ItemSpawner: Invalid call to OnEvent");
            break;
        }
    }
Esempio n. 4
0
    void OnEvent(GameEvent ev)
    {
        switch (ev.Type())
        {
        case GameEventType.EVENT_START_QUEST:
        {
            EventStartQuest quest = (EventStartQuest)ev;

            if (quest.quest == QuestType.QT_SPEEDS)
            {
                HouseManager.Instance.GetHousesOrderedByPoints();
                if (HouseManager.Instance.GetHousesOrderedByPoints()[0].GetPlayerInstance().gameObject == gameObject)
                {
                    speed_delta = player_max_speed * -0.5f;
                }
                else if (HouseManager.Instance.GetHousesOrderedByPoints()[2].GetPlayerInstance().gameObject == gameObject)
                {
                    speed_delta = player_max_speed * 0.5f;
                }
            }
            break;
        }

        case GameEventType.EVENT_END_QUEST:
            speed_delta = 0f;
            break;

        case GameEventType.EVENT_MATCH_START:
        {
            SetMovementEnabled(true);
            break;
        }

        default:
            break;
        }
    }