本文整理汇总了C#中Inventory.inventorySwitchWeapon方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.inventorySwitchWeapon方法的具体用法?C# Inventory.inventorySwitchWeapon怎么用?C# Inventory.inventorySwitchWeapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory.inventorySwitchWeapon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
/// <summary>
/// The initializer for this object.
/// </summary>
protected override void Start()
{
//Grab the weapon switcher
wepSwitcher = gameObject.GetComponentInChildren<WeaponModelSwitcher>();
//Grab an instance of the inventory
inventory = Inventory.getInstance();
//Add the default weapons
ItemEquipment myFirstPickaxe = new ItemWeapon(1, 1.0f, 0, 0, 0.0f, "Rusty Pickaxe", ItemWeapon.tWeaponType.WeaponPickaxe, "A slightly worn, but reliable pickaxe.", ItemBase.tOreType.Copper);
string bladeCode = ItemComponent.generateComponentCode(ItemComponent.tAttributeType.Normal, ItemBase.tOreType.Bone, ItemWeapon.tWeaponType.WeaponSword,
ItemComponent.tComponentPart.Blade);
string handleCode = ItemComponent.generateComponentCode(ItemComponent.tAttributeType.Normal, ItemBase.tOreType.Bone, ItemWeapon.tWeaponType.WeaponSword,
ItemComponent.tComponentPart.Handle);
ItemWeapon myFirstSword = ItemFactory.createWeapon(ItemFactory.createComponent(bladeCode), ItemFactory.createComponent(handleCode));
inventory.inventoryAddItem(myFirstPickaxe);
inventory.inventoryAddItem(myFirstSword);
cheat(cheatAmount.a_little);//add all weapons
//cheat(cheatAmount.a_lot);//add all weapons and make them top tier
base.Start();
inventory.initialize();//calling initialize here ensures inventory Character field is set before it is used
inventory.inventorySwitchWeapon();
//Create a new gameobejct with a GUITexture attached to it
damageTexture = new GameObject();
damageTexture.AddComponent("GUITexture");
//Store away the color struct that gets returned and change it before saving it back again. Can't change color.a in one line
Color damageTextureColor = damageTexture.guiTexture.color;
damageTextureColor.a = 0;
//Get the texture that should take up the whole screen
Texture2D hurtScreen = (Texture2D)Resources.Load("HurtScreen");
//Center the damageTexture
Vector3 damagePos = damageTexture.transform.position;
damagePos.x = 0.5f; //GUITexture corrdinates are a bit different than usual ones
damagePos.y = 0.5f;
damagePos.z = 0f;
damageTexture.transform.position = damagePos;
damageTexture.guiTexture.texture = hurtScreen;
damageTexture.guiTexture.color = damageTextureColor;
}