Exemplo n.º 1
0
    public void OnMachineInput(ITransportable transportable)
    {
        Resource resource = transportable.OnPeek();

        if (ResourceInput == null)
        {
            ResourceInput        = Instantiate(resource);
            ResourceInput.amount = 0;
        }

        //Is this resource not wood?
        if (!resource.title.Equals("Wood"))
        {
            transportable.OnRejected();
            return;
        }
        //Is the input amount full
        if (ResourceInput.IsFull)
        {
            transportable.OnRejected();
            return;
        }

        //Callback for picking up the transport
        transportable.OnPickup();

        ResourceInput.Add(ref resource);

        OnInput();
    }