Example #1
0
    public void CloseContainer()
    {
        // TODO ship the container, if money is available (and if theres a non shipped container)
        // TODO maybe destroy the box???

        shippedContainer = (ShippableContainer)fillableContainer.Ship();
        if (!shippedContainer)
        {
            Debug.LogWarning("ShippedContainer --- wrong type!!!");
            return;
        }

        // at this point the shipped stage is reached and we can set up events
        shippedContainer.OnShipment += () =>
        {
            SpawnContainer();
            // TODO also add money
            Debug.Log("Shipment");
            EventScript.Instance.EventQueue.AddEvent(new ManageMoneyEvent(shippedContainer.Box.MoneyValue));
            EventScript.Instance.EventQueue.AddEvent(new ManageTimeEvent(20));             // TODO must be moved somewhere else
        };
    }