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


C# Items类代码示例

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


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

示例1: Start

    void Start()
    {
        player = gameObject.transform.parent.GetComponentInChildren<Player>();

        //let's create the player
        items = new Items();
        characters = new Characters();
        if (items.LoadItems() && characters.LoadCharacters())
        {
            prefab = Resources.Load(characters.GetCharacter("Guy").GetDirectory(), typeof(GameObject));
            PlayerObject = Instantiate(prefab) as GameObject;
            PlayerObject.transform.position = new Vector3(0, 0.5f, 0);
            PlayerObject.transform.SetParent(gameObject.transform.parent.FindChild("PlayerObject").transform);

            for (int i = -4; i <= 4; i++) //initial 8 tiles
            {
                int rand = Random.Range(0, 2);
                item = items.GetItem(TilesArray[rand]);
                prefab = Resources.Load(item.GetDirectory(), typeof(GameObject));
                ObjectI = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
                ObjectI.transform.position = new Vector3(i * 9, 0, 0) + item.GetBasePosition();
                ObjectI.transform.SetParent(gameObject.transform.FindChild("Tiles").transform);
                tiles.Add(ObjectI);
            }
        }
    }
开发者ID:edumntg,项目名称:jump-dodge,代码行数:26,代码来源:Generation.cs

示例2: getZipWithLocalO2Scripts

        public static string getZipWithLocalO2Scripts()
        {
            var tempDir = "_TempScriptsFolder".tempDir();
            var localScriptsFolder = PublicDI.config.LocalScriptsFolder;
            var tempScriptsFolder = tempDir.pathCombine("O2.Platform.Scripts");
            var zipFile = tempDir.pathCombine("O2.Platform.Scripts.zip");

            "[getZipWithLocalO2Scripts] Step 1: Copying files".debug();
            Files.copyFolder(localScriptsFolder, tempDir, true, false, ".git");

            "[getZipWithLocalO2Scripts] Step 2: calculating Hashes".debug();
            var files = tempScriptsFolder.files(true);
            var items = new Items();
            foreach (var file in files)
            {
                var hash = file.fileContents_AsByteArray().hash();
                items.add(file.remove(tempScriptsFolder + "\\"), hash.str());
            }
            var hashesFile = tempScriptsFolder.pathCombine("ScriptHashes-{0}.xml".format(DateTime.Now.safeFileName()));
            items.saveAs(hashesFile);

            "[getZipWithLocalO2Scripts] Step 3: Creating Zip".debug();
            tempScriptsFolder.zip_Folder(zipFile);

            return zipFile;
        }
开发者ID:sempf,项目名称:FluentSharp,代码行数:26,代码来源:O2Scripts.cs

示例3: Interact

    // Called when an object is interacted with.
    public override Items.Item Interact(Items.Item item = null)
    {
        Items.Item toReturn = null;

        if (tags.Contains("CARROT"))
        {
            World.textbox.Write("You got some carrots.");
            toReturn = Items.getItemWithName("carrot");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("CORN"))
        {
            World.textbox.Write("You got some corn.");
            toReturn = Items.getItemWithName("corn");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("LETTUCE"))
        {
            World.textbox.Write("You got some lettuce.");
            toReturn = Items.getItemWithName("lettuce");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }
        else if (tags.Contains("TOMATO"))
        {
            World.textbox.Write("You got some tomato.");
            toReturn = Items.getItemWithName("tomato");
            TurnInto(afterInteraction[Random.Range(0, afterInteraction.Length)]);
            World.AddChaos(World.STEAL);
        }

        return toReturn;
    }
开发者ID:IzumiMirai,项目名称:CSSeniorProject,代码行数:36,代码来源:Crop.cs

示例4: SetItems

        /// <summary>
        /// Sets the items to be used in the comparison.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="item1"></param>
        /// <param name="item2"></param>
        public void SetItems(
            Items.ItemProperty[] properties,
            Items.Item item1,
            Items.Item item2)
        {
            // clear out any prior contents
            RowHost.Children.Clear();
            RowHost.RowDefinitions.Clear();

            // set up our row/column definitions
            for (int index = 0; index < properties.Length; ++index)
            {
                RowHost.RowDefinitions.Add(new RowDefinition());
            }

            // add our columns
            for (int index = 0; index < properties.Length; ++index)
            {
                ComparisonRow row = new ComparisonRow();
                Grid.SetRow(row, index);
                RowHost.Children.Add(row);                
                row.HeadingLabel.Text = properties[index].Name;
                row.Cell1.SetValue(item1.Values[index], properties[index].PropertyType);
                row.Cell2.SetValue(item2.Values[index], properties[index].PropertyType);
            }

            ItemBrand1.Text = item1.Brand;
            ItemBrand2.Text = item2.Brand;
            ItemName1.Text = item1.Name;
            ItemName2.Text = item2.Name;
        }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:37,代码来源:ComparisonTable.xaml.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     activeboublecolor = bouble.color;
     item = Items.EMPTY;
     bouble.color = Color.clear;
     coloritem = Color.white;
 }
开发者ID:hydro-team,项目名称:hydro,代码行数:8,代码来源:Inventory.cs

示例6: EquipWeapon

        public void EquipWeapon(Items thing)
        {
            if(thing is Weapon)
            {
                if(weaponCapacity>0)
                {
                    this.Equiped.Add(thing);

                    if (thing is Saber)
                    {
                        var temp = (Saber)thing;

                        attacks.Add(new LightAttackAbility(temp,this));
                    }
                    else if(thing is DarkStaff)
                    {
                        var temp = (DarkStaff)thing;
                        attacks.Add(new LightMagicAbility(temp,this));
                    }
                    weaponCapacity--;
                    this.Inventory.Remove(thing);
                }

                //else { Console.WriteLine("Not Allowed"); }
            }
        }
开发者ID:GeorgiNik,项目名称:TelerikAcademy,代码行数:26,代码来源:Player.cs

示例7: UneqipWeapon

        public void UneqipWeapon(Items thing)
        {
            if (thing is Weapon)
            {
                Equiped.Remove(thing);
                Inventory.Add(thing);

                if (thing is Saber)
                {
                    var temp = (Saber)thing;
                    LightAttackAbility tempAbility = new LightAttackAbility(temp,this);
                    var tempR=attacks.Find(o=>o.Name==thing.Name+" Light Attack");
                    attacks.Remove(tempR);
                }
                else
                {
                    var temp=(DarkStaff)thing;
                    LightMagicAbility tempAbility = new LightMagicAbility(temp,this);
                    var tempR = attacks.Find(o => o.Name == thing.Name + " Light Magic Attack");
                    attacks.Remove(tempR);
                }

                weaponCapacity++;
            }
        }
开发者ID:GeorgiNik,项目名称:TelerikAcademy,代码行数:25,代码来源:Player.cs

示例8: AddToInventory

 /// <summary>
 /// Adds item to the inventory, keeps already existing items
 /// </summary>
 /// <param name="items">Items.</param>
 public void AddToInventory(Items items, Texture texture)
 {
     float __x = _xPos - inventoryItem.Count * _xOffset;
     Rect __rect = new Rect(__x, _outYPos,_sizeButton,_sizeButton);
     inventoryItem.Add( new InventoryItem(items, texture,__rect));
     StartCoroutine(_MoveItemDown(inventoryItem[inventoryItem.Count-1]));
 }
开发者ID:hilvi,项目名称:MimmitAndroid,代码行数:11,代码来源:Inventory.cs

示例9: EquipItem

        public bool EquipItem(Items.Iitem item, Inventory inventory)
        {
            bool result = false;

            Items.Iweapon weaponItem = item as Items.Iweapon;
            if (weaponItem != null && weaponItem.IsWieldable) {
                //can't equip a wieldable weapon
            }
            else {
                if (!equipped.ContainsKey(item.WornOn)) {
                    equipped.Add(item.WornOn, item);
                    if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                        inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                    }
                    result = true;
                }
                else if (item.WornOn == Items.Wearable.WIELD_LEFT || item.WornOn == Items.Wearable.WIELD_RIGHT) { //this item can go in the free hand
                    Items.Wearable freeHand = Items.Wearable.WIELD_LEFT; //we default to right hand for weapons
                    if (equipped.ContainsKey(freeHand)) freeHand = Items.Wearable.WIELD_RIGHT; //maybe this perosn is left handed
                    if (!equipped.ContainsKey(freeHand)) { //ok let's equip this
                        item.WornOn = freeHand;
                        item.Save();
                        equipped.Add(freeHand, item);
                        if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                            inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                        }
                        result = true;
                    }
                }
            }

            return result;
        }
开发者ID:vadian,项目名称:Novus,代码行数:33,代码来源:Equipment.cs

示例10: InitializeData

    /// <summary>
    /// Initialize interface with default data. 
    /// </summary>
    /// <param name="result"></param>
    public void InitializeData( Items.BaseItem result )
    {
      var res = result as Items.TestResult;

      if( null == res )
      {
        throw new ArgumentException( "Invalid argument type." );
      }

      var isExecuted = res.IsExecuted;

      lblAsserts.Visible = isExecuted;
      lblTime.Visible = isExecuted;
      lblAssertsCap.Visible = isExecuted;
      lblTimeCap.Visible = isExecuted;
      lblErrors.Text = res.Errors ?? "";
      lblFailures.Text = res.Failures ?? "";
      if( isExecuted )
      {
        lblAsserts.Text = res.Asserts.Value.ToString();
        lblTime.Text = res.Time;
      }

      lblExecuted.Text = res.IsExecuted.ToString();
      lblName.Text = res.Name;
      lblresult.Text = res.TestResultValue.ToString();
      lblresult.ForeColor = ( res.TestResultValue == Items.TestResultsEnum.Error ||
        res.TestResultValue == Items.TestResultsEnum.Failure ||
        res.TestResultValue == Items.TestResultsEnum.Invalid ) ? Color.Red : Color.Black;
    }
开发者ID:buonan,项目名称:NUnitTestResultsViewerCode,代码行数:34,代码来源:CompTestResult.cs

示例11: SetItem

        /// <summary>
        /// Sets the item and properties to display.
        /// </summary>
        /// <param name="properties">An array of properties to display.</param>
        /// <param name="item">The item to display.</param>
        public void SetItem(
            Items.ItemProperty[] properties,
            Items.Item item)
        {
            // clear out any prior contents
            RowHost.Children.Clear();
            RowHost.RowDefinitions.Clear();

            // set up our row definitions
            for (int index = 0; index < properties.Length; ++index)
            {
                RowHost.RowDefinitions.Add(new RowDefinition());
            }

            // add our rows
            for (int index = 0; index < properties.Length; ++index)
            {
                InformationPanelRow row = new InformationPanelRow();
                Grid.SetRow(row, index);
                RowHost.Children.Add(row);              
                row.HeadingLabel.Text = properties[index].Name;                
                row.Cell.SetValue(item.Values[index], properties[index].PropertyType);
            }

            ItemBrandPanel.Text = item.Brand;
            ItemNamePanel.Text = item.Name;
        }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:32,代码来源:ItemVisualization.xaml.cs

示例12: addToInventory

 public void addToInventory(Items.seeds seed,int amount)
 {
     Items.seeds s = null;
     bool found = false;
     if (seeds.Count == 0)
     {
         seeds.Add(seedcnt, list.cloneSeed(seed));
         seeds[seedcnt].addAmount(amount);
         seedcnt++;
     }
     else
     {
         foreach (KeyValuePair<int, Items.seeds> entry in seeds)
         {
             if (entry.Value.getID() == seed.getID() && found == false)
             {
                 s = entry.Value;
                 found = true;
             }
         }
         if (found)
         {
             s.addAmount(amount);
         }
         else
         {
             seeds.Add(seedcnt, list.cloneSeed(seed));
             seeds[seedcnt].addAmount(amount);
             seedcnt++;
         }
     }
 }
开发者ID:Lomacil,项目名称:Harvest,代码行数:32,代码来源:Inventory.cs

示例13: Task

 /// <summary>
 /// Létrehoz egy feladatot a megadott típussal és célponttal
 /// </summary>
 /// <param name="Type">A feladat típusa</param>
 /// <param name="Item">A feladat célpontja</param>
 public Task(TaskType Type, Items.ItemBase Item)
 {
     if (Type == TaskType.Any) { throw new ArgumentException("TaskType.Any cannot be used here"); }
     this.Type = Type;
     this.Item = Item;
     this.AssignedSince = Statistics.CurrentLoop;
 }
开发者ID:solymosi,项目名称:hangyaboly,代码行数:12,代码来源:Task.cs

示例14: SecretBrick

        public SecretBrick(int x, int y, Items.Item item)
        {
            this.Breakable = true;
            this.Solid = true;
            this.Position = new Rectangle(x * 24, y * 24, 24, 24);
            this.ImageCount = 0f;
            this.ImageIndex = 0;
            this.ImageSpeed = 1f;
            this.ImageTime = 10f;
            this.HeldItem = item;
            this.OffsetX = 0;
            this.OffsetY = 0;
            if(HeldItem is Items.ItemCoin)
                this.BreakSound = Game1.otherSounds[2];
            else
                this.BreakSound = Game1.otherSounds[3];
            this.HitSound = Game1.otherSounds[1];

            this.SrcRect = new Rectangle[10];
            for (int i = 0; i < this.SrcRect.Length; i++)
            {
                if (i < 7)
                    this.SrcRect[i] = new Rectangle(136, 0, 16, 16);
                else
                    this.SrcRect[i] = new Rectangle(136 + (i - 6) * 17, 0, 16, 16);
            }
        }
开发者ID:JohnP42,项目名称:super-luigi,代码行数:27,代码来源:SecretBrick.cs

示例15: CanHarvest

 public override bool CanHarvest(Items.ToolItem tool)
 {
     return tool is PickaxeItem &&
         (tool.ToolMaterial == ToolMaterial.Iron ||
         tool.ToolMaterial == ToolMaterial.Gold ||
         tool.ToolMaterial == ToolMaterial.Diamond);
 }
开发者ID:ammaraskar,项目名称:Craft.Net,代码行数:7,代码来源:DiamondBlock.cs


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