示例#1
0
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        // For testing purposes only; allows activating death from inspector
        if (activateDeath)
        {
            Die();
            activateDeath = false;
        }


        if (Input.GetKeyDown(KeyCode.F))
        {
            CmdDie();
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (uiManager.IsInventoryOpen())
            {
                uiManager.DisableInventoryScreen();
            }
            else
            {
                uiManager.EnableInventoryScreen();
            }
        }

        for (int i = 1; i <= 6; i++)
        {
            if (Input.GetKeyDown(i.ToString()))
            {
                if (i - 1 == activeHotbarSlot)
                {
                    DeactivateHotbarSlot();
                }
                else
                {
                    ActivateHotbarSlot(i - 1);
                }
            }
        }

        if (Input.GetMouseButtonDown(1) && !isControllingShip)
        {
            if (IsItemEquipped && animationController.CurrentEquippedItemID != 0)
            {
                animationController.SetAiming(true, ItemManager.Dictionary.GetItem(animationController.CurrentEquippedItemID).AimFovMultiplier);
            }
        }
        else if (Input.GetMouseButtonUp(1))
        {
            animationController.SetAiming(false);
        }

        if (Input.GetMouseButtonDown(0) && !isControllingShip)
        {
            if (IsItemEquipped && animationController.CurrentEquippedItemID != 0)
            {
                animationController.ActivateAttack();
            }
        }
    }