当前位置: 首页>>代码示例>>C#>>正文


C# Inventory类代码示例

本文整理汇总了C#中Inventory的典型用法代码示例。如果您正苦于以下问题:C# Inventory类的具体用法?C# Inventory怎么用?C# Inventory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Inventory类属于命名空间,在下文中一共展示了Inventory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: invoke

	public override void invoke(Inventory invoker) {
		audioSource.Play();
		foreach (AbstractPowerSource source in AbstractPowerSource.powerSources) {
			if (Vector3.Distance(invoker.transform.position, source.transform.position) < range)
				source.disable(disableTime);
		}
	}
开发者ID:viviannimue,项目名称:OpenCircuit,代码行数:7,代码来源:PocketEMP.cs

示例2: Start

	void Start()
	{
		GameObject goItemManager = GameObject.FindGameObjectsWithTag("GameManager").FirstOrDefault( (go) => go.name == "Item Manager" );
		if( null == goItemManager )
			Debug.LogError( "Failed to find Item Manager game object");
		else
			m_Inventory = new Inventory( goItemManager.GetComponent<InventoryManager>() );

		m_Path = GetComponent<AIPath>();
		m_Seeker = GetComponent<Seeker>();

		// Find the start locator and set our position/orientation
		if( !string.IsNullOrEmpty( m_StartLocatorName ) )
		{
			GameObject[] locators = GameObject.FindGameObjectsWithTag( "Locator" );
			if( locators.Length > 0 )
			{
				GameObject startLocator = locators.FirstOrDefault( (i) => { return i.name == m_StartLocatorName; } );

				if( null != startLocator )
				{
					transform.position = startLocator.transform.position;
					transform.rotation = startLocator.transform.rotation;
				}
			}
		}
	}
开发者ID:predominant,项目名称:Treasure_Chest,代码行数:27,代码来源:Player.cs

示例3: OnQueryInventorySucceeded

 private void OnQueryInventorySucceeded(string json)
 {
     if (queryInventorySucceededEvent != null) {
         Inventory inventory = new Inventory(json);
         queryInventorySucceededEvent(inventory);
     }
 }
开发者ID:noqno,项目名称:open-iab-unity,代码行数:7,代码来源:OpenIABEventManager.cs

示例4: InitFromInventory

 /// <summary>
 /// Reset and initialize the entire view based on the given Inventory.</summary>
 public void InitFromInventory(Inventory inventory)
 {
     foreach (KeyValuePair<InventoryItem, InventoryViewItem> entry in _items)
     {
         Destroy(entry.Value.gameObject);
     }
     _items.Clear();
     _numberOfSlots = inventory._items.Count;
     ResetSlots();
     int currentActionSlot = 0;
     for (int i=0; i < inventory._items.Count; i++)
     {
         var invItem = AddItem(inventory._items[i], inventory._quantities[i]);
         // Update the weapon Slot
         if (inventory._items[i] == Player._player.Stats._equippedWeapon)
         {
             _weaponSlot.Swap(invItem);
         }
         if (Player._player.Stats._equippedItems.Contains(inventory._items[i]))
         {
             PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = true;
             PlayerMenu._playerMenu._actionSlots[currentActionSlot].Swap(invItem);
             PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = false;
             currentActionSlot += 1;
         }
     }
 }
开发者ID:PaulSchweizer,项目名称:GameDev,代码行数:29,代码来源:InventoryView.cs

示例5: OnTradeAddItem

        public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
        {
            // USELESS DEBUG MESSAGES -------------------------------------------------------------------------------
            SendTradeMessage("Object AppID: {0}", inventoryItem.AppId);
            SendTradeMessage("Object ContextId: {0}", inventoryItem.ContextId);

            switch (inventoryItem.AppId)
            {
                case 440:
                    SendTradeMessage("TF2 Item Added.");
                    SendTradeMessage("Name: {0}", schemaItem.Name);
                    SendTradeMessage("Quality: {0}", inventoryItem.Quality);
                    SendTradeMessage("Level: {0}", inventoryItem.Level);
                    SendTradeMessage("Craftable: {0}", (inventoryItem.IsNotCraftable ? "No" : "Yes"));
                    break;

                case 753:
                    GenericInventory.ItemDescription tmpDescription = OtherSteamInventory.getDescription(inventoryItem.Id);
                    SendTradeMessage("Steam Inventory Item Added.");
                    SendTradeMessage("Type: {0}", tmpDescription.type);
                    SendTradeMessage("Marketable: {0}", (tmpDescription.marketable ? "Yes" : "No"));
                    break;

                default:
                    SendTradeMessage("Unknown item");
                    break;
            }
            // ------------------------------------------------------------------------------------------------------
        }
开发者ID:Timboy67678,项目名称:SteamBot,代码行数:29,代码来源:SteamTradeDemoHandler.cs

示例6: Start

 // Use this for initialization
 void Start()
 {
     itemImage = gameObject.GetComponent<Image> ();
     defaultPosition = transform.localPosition;
     myInv = transform.GetComponentInParent<Inventory> ();
     //defaultPosition.z = 0
 }
开发者ID:t-conti,项目名称:Turn-Based-God,代码行数:8,代码来源:SlotScript.cs

示例7: LocalObject

    public LocalObject(LocalShape localShape, string _uniqueName = "", Inventory _inventory = null)
    {
        uniqueName = _uniqueName;
        shape = new ShapeComponent(localShape, this);

        if (localShape.type == LocalType.Get("Destructible") || localShape.type == LocalType.Get("Container"))
        {
            hp = new HPComponent(this);
        }
        else if (localShape.type == LocalType.Get("Creature"))
        {
            hp = new HPComponent(this);
            movement = new Movement(this);
            defence = new Defence(this);
            attack = new Attack(this);
            abilities = new Abilities(this);
            fatigue = new Fatigue(this);
            eating = new Eating(this);
        }

        if (_inventory != null)
        {
            inventory = new Inventory(6, 1, "", false, null, this);
            _inventory.CopyTo(inventory);
        }
    }
开发者ID:mxgmn,项目名称:GENW,代码行数:26,代码来源:LocalObject.cs

示例8: Awake

	void Awake(){
		gameObject.name = gameObject.name.Replace("(Clone)", "");
		Player = GameObject.FindWithTag("Player").transform;
		hcs = Player.GetComponent<HeroControllerScript>();
		inv = Player.GetComponent<Inventory>();
		ItemObject = Resources.Load(gameObject.name) as GameObject;
	}
开发者ID:Vasj0001,项目名称:Game,代码行数:7,代码来源:Items.cs

示例9: DecorationInventory

 public DecorationInventory(Inventory inventory)
 {
     this.inventory				= inventory;
     this.pockets				= new Dictionary<DecorationTypes, DecorationPocket>();
     this.secretBaseDecorations	= new List<PlacedDecoration>();
     this.bedroomDecorations		= new List<PlacedDecoration>();
 }
开发者ID:trigger-death,项目名称:TriggersPC,代码行数:7,代码来源:DecorationInventory.cs

示例10: GetToolTip

    public override string GetToolTip (Inventory inv) {

        string stats = string.Empty;

        if (Health > 0) {
            stats += "\nRestores " + Health.ToString() + " health";
        }
        if (Mana > 0)
        {
            stats += "\nRestores " + Mana.ToString() + " energy";
        }
        if (Rage > 0)
        {
            stats += "\nRestores " + Rage.ToString() + " rage";
        }
        string itemTip = base.GetToolTip(inv);

        if (inv is VendorInventory) {
            return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Buy Price: {2} Crumbs</color></size>", itemTip, stats, BuyPrice);
        } 
        else if (VendorInventory.Instance.IsOpen) {
            return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Sell Price: {2} Crumbs</color></size>", itemTip, stats, SellPrice);
        } 
        else {
            return string.Format("{0}" + "<size=20>{1}</size>", itemTip, stats);
        }

    }
开发者ID:Fahrettin52,项目名称:Game-Lab-1.1,代码行数:28,代码来源:Consumable.cs

示例11: Update

    void Update()
    {
        if (itemId == -1)
            return;
        //如果快捷栏有物品,则刷新物品状态
        if (inventory == null)
        {
            UnityEngine.GameObject canvas = UnityEngine.GameObject.FindGameObjectWithTag("Canvas");
            inventory = canvas.transform.Find("Panel - Inventory(Clone)").GetComponent<Inventory>();
        }
        if (inventory == null)
            return;
        //物品已使用完或者消失
        UnityEngine.GameObject itemobject = inventory.getItemGameObject(itemId);
        if (itemobject == null)
        {
            this.itemId = -1;
            this.gameObject.SetActive(false);
            return;
        }

        image_icon.sprite = itemobject.GetComponent<ItemOnObject>().item.itemIcon;
        text.rectTransform.localPosition = itemobject.transform.GetChild(1).GetComponent<Text>().transform.localPosition;
        text.enabled = true;
        text.text = itemobject.transform.GetChild(1).GetComponent<Text>().text;
        if (ConsumeLimitCD.instance.isWaiting())
        {
            image_cool.fillAmount = ConsumeLimitCD.instance.restTime / ConsumeLimitCD.instance.totalTime;
        }
        else
        {
            image_cool.fillAmount = 0;
        }
    }
开发者ID:liuxq,项目名称:TestGame,代码行数:34,代码来源:HotBarProcess.cs

示例12: Awake

 void Awake()
 {
     PickUpSound = gameObject.GetComponent<AudioSource> ();
     PickUpSound.clip = PickUpClip;
     player = GameObject.FindGameObjectWithTag ("Player");
     inv = canv.GetComponent<Inventory>();
 }
开发者ID:sea1and,项目名称:SurvivalGame,代码行数:7,代码来源:PickUpManager.cs

示例13: GetCurrentInfo

        public StatsExport GetCurrentInfo(Inventory inventory)
        {
            var stats = inventory.GetPlayerStats().Result;
            StatsExport output = null;
            var stat = stats.FirstOrDefault();
            if (stat != null)
            {
                var ep = stat.NextLevelXp - stat.PrevLevelXp - (stat.Experience - stat.PrevLevelXp);
                var time = Math.Round(ep/(TotalExperience/GetRuntime()), 2);
                var hours = 0.00;
                var minutes = 0.00;
                if (double.IsInfinity(time) == false && time > 0)
                {
                    time = Convert.ToDouble(TimeSpan.FromHours(time).ToString("h\\.mm"), CultureInfo.InvariantCulture);
                    hours = Math.Truncate(time);
                    minutes = Math.Round((time - hours)*100);
                }

                output = new StatsExport
                {
                    Level = stat.Level,
                    HoursUntilLvl = hours,
                    MinutesUntilLevel = minutes,
                    CurrentXp = stat.Experience - stat.PrevLevelXp - GetXpDiff(stat.Level),
                    LevelupXp = stat.NextLevelXp - stat.PrevLevelXp - GetXpDiff(stat.Level),
                };
            }
            return output;
        }
开发者ID:CapSnake,项目名称:NecroBot,代码行数:29,代码来源:Statistics.cs

示例14: Reset

 public void Reset(ISettings settings, ILogicSettings logicSettings)
 {
     Client = new Client(Settings) {AuthType = settings.AuthType};
     // ferox wants us to set this manually
     Inventory = new Inventory(Client, logicSettings);
     Navigation = new Navigation(Client);
 }
开发者ID:CalebD44,项目名称:NecroBot,代码行数:7,代码来源:Session.cs

示例15: Start

 void Start()
 {
     anim = GetComponent<Animator>();
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     player = GameObject.FindGameObjectsWithTag("Player")[0];
 }
开发者ID:VictorVaxb,项目名称:SurvivalCurse,代码行数:7,代码来源:Enemy2.cs


注:本文中的Inventory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。