コード例 #1
0
ファイル: ItemPickup.cs プロジェクト: Epicguru/NotQuiteDead
    public void Update()
    {
        // This is an item, on the floor, that has a collider. Yep.

        if (MouseOver)
        {
            if (AllowPickup && !Item.IsEquipped())
            {
                // Show the user that they can pick this item up.
                if (InputManager.Active)
                {
                    string key      = InputManager.GetInput("Pick up").ToString();
                    string itemName = RichText.InBold(RichText.InColour(Item.Name, ItemRarityUtils.GetColour(Item.Rarity)));
                    ActionHUD.DisplayAction("PickupPrompt".Translate(key, itemName));
                }
                if (InputManager.InputDown("Pick up"))
                {
                    // Check client-server situation...
                    if (isServer)
                    {
                        // Pick up manually.
                        Item.RequestDataUpdate();
                        PickupAccepted(Item.Data);
                        Destroy(this.gameObject);
                    }
                    else
                    {
                        // Pick up using the command.
                        Player.Local.NetUtils.CmdRequestPickup(Player.Local.gameObject, this.gameObject);
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: ActionHUD.cs プロジェクト: Epicguru/NotQuiteDead
 public void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
コード例 #3
0
    public void Update()
    {
        Vector2 mousePos    = InputManager.GetMousePos();
        int     mouseX      = (int)mousePos.x;
        int     mouseY      = (int)mousePos.y;
        bool    mouseInside = mouseX == Furniture.X && mouseY == Furniture.Y;

        if (mouseInside)
        {
            string key = InputManager.GetInput("Interact").ToString();
            ActionHUD.DisplayAction("Blueprint_OpenPrompt".Translate(key));
            if (InputManager.InputDown("Interact"))
            {
                Workbench.Bench.Open = true;
            }
        }
    }
コード例 #4
0
ファイル: ActionHUD.cs プロジェクト: Epicguru/NotQuiteDead
 public void Start()
 {
     Instance = this;
     Text     = GetComponentInChildren <Text>();
 }