Example #1
0
    public override void Tick(float deltaTime)
    {
        for (int i = 0; i < filters.Length; i++)
        {
            // cache variables
            Filter              filter        = filters[i];
            InventoryComponent  inventoryComp = filter.inventoryComponent;
            InputComponent      inputComp     = filter.inputComponent;
            InteractorComponent interactComp  = filter.interactorComponent;


            // ----- logic -----
            if (inputComp.GetKeyDown(KeyCode.E) || inputComp.GetButtonDown("Fire1"))
            {
                isGathering = true;
            }
            else if (inputComp.GetKeyUp(KeyCode.E) || inputComp.GetButtonUp("Fire1") || isGathering == false)
            {
                //stop gather
                interactedTime = 0f;
                isGathering    = false;
                player.uiComponent.gatheringPrompt.ProgressFill(0);
            }

            if (isGathering)
            {
                AttemptWorldInteract(interactComp, player.inventoryComponent, inputComp.worldInteractMask);
                interactComp.SetInteractMode(InteractMode.Object);
            }
        }
    }