Utility.getPostInt C# (CSharp) Method

getPostInt() public static method

public static getPostInt ( string name ) : Int32
name string
return Int32
    public static Int32 getPostInt(string name)
    {
        return Int32.Parse(name.Substring(name.IndexOf('_')+1));
    }

Usage Example

示例#1
0
    void OnItemPick()
    {
        if (_player == null)
        {
            _player = UnityEngine.GameObject.FindGameObjectWithTag("Player");
        }
        if (_inventory == null && _player != null)
        {
            _inventory = _player.GetComponent <PlayerInventory>().inventory.GetComponent <Inventory>();
        }
        if (_inventory != null)
        {
            float distance = Vector3.Distance(this.gameObject.transform.position, _player.transform.position);

            if (distance <= 3)
            {
                //bool check = _inventory.checkIfItemAllreadyExist(item.itemID, item.itemValue);
                //if (check)
                //    Destroy(this.gameObject);
                if (_inventory.ItemsInInventory.Count < (_inventory.width * _inventory.height))
                {
                    DroppedItem item = (DroppedItem)KBEngineApp.app.findEntity(Utility.getPostInt(gameObject.name));
                    if (item != null)
                    {
                        item.pickUpRequest();
                    }
                    //_inventory.addItemToInventory(item.itemID, item.itemValue);
                    //_inventory.updateItemList();
                    //_inventory.stackableSettings();
                    //Destroy(this.gameObject);
                }
            }
        }
    }
All Usage Examples Of Utility::getPostInt