本文整理汇总了C#中Material.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Material.ToString方法的具体用法?C# Material.ToString怎么用?C# Material.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Material
的用法示例。
在下文中一共展示了Material.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MaterialRow
public MaterialRow(Material material)
{
Material = material;
var str = material.ToString();
switch (str)
{
case "StoneStart":
Name = "Granite";
break;
case "StoneEnd":
Name = "Brick";
break;
case "MetalStart":
Name = "Copper";
break;
case "MetalEnd":
Name = "Platinum";
break;
case "LeatherStart":
Name = "YakHide";
break;
case "LeatherEnd":
Name = "BearHide";
break;
default:
Name = str;
break;
}
}
示例2: CheckShaderAndCreateMaterial
public static Material CheckShaderAndCreateMaterial( Shader s , Material m2Create )
{
if (m2Create && m2Create.shader == s)
return m2Create;
if (!s) {
Debug.LogWarning("PostEffects: missing shader for " + m2Create.ToString ());
return null;
}
if(!s.isSupported) {
Debug.LogWarning ("The shader " + s.ToString () + " is not supported");
return null;
}
else {
m2Create = new Material (s);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
}
示例3: activateWorldTexture
private void activateWorldTexture(Material.WorldTexture type, ref int texunit, int handle)
{
string name = type.ToString();
int texid = Scene.getTextureId(type);
if (texid != 0)
{
GL.ActiveTexture(TextureUnit.Texture0 + texunit);
GL.BindTexture(TextureTarget.Texture2D, texid);
GL.Uniform1(GL.GetUniformLocation(handle, name), texunit);
texunit++;
}
}
示例4: Get_Permitivity
public static string Get_Permitivity(Material material)
{
switch (material)
{
case Material.GaAs:
return "eps_r_GaAs * eps_0";
case Material.AlGaAs:
return "eps_r_AlGaAs * eps_0";
case Material.InGaAs:
return "eps_r_InGaAs * eps_0";
case Material.InAlAs:
return "eps_r_InAlAs * eps_0";
case Material.PMMA:
return "eps_pmma * eps_0";
case Material.Al2O3:
return "eps_al2o3 * eps_0";
case Material.Metal:
return "0.0";
case Material.Air:
return "eps_0";
default:
throw new NotImplementedException("Error - Cannot find electrical permitivity for material: " + material.ToString());
}
}
示例5: NewItem
private Item NewItem(Vector3 position, ItemID itemId, Material material, List<Item> components)
{
return components.Any()
? new Item(position, itemId.ToString(), components)
: new Item(position, itemId.ToString(), material.ToString());
}
示例6: CreateSimpleItem
private Item CreateSimpleItem(ItemID itemId, Material material, Vector3 position)
{
var componentSource = GetComponentSource(material, position);
Item newItem;
if (material==Material.BlueGem || material == Material.GreenGem) /* special case - fix 23/03/2016 chatmetaleux */
{
newItem = new Item(position, itemId.ToString(), (material == Material.BlueGem) ? "Sapphire":"Emerald");
}
else
newItem = new Item(position, itemId.ToString(), material.ToString());
if (componentSource != null)
{
newItem.CrafterHistory = componentSource.Character.History;
if (componentSource.ShouldDestroy)
{
componentSource.Character.LeftRegion();
}
}
GnomanEmpire.Instance.EntityManager.SpawnEntityImmediate(newItem);
return newItem;
}
示例7: CreateComponents
private List<Item> CreateComponents(ItemID itemId, Material material, Vector3 position)
{
var components = new List<Item>();
var subComponents = new List<Item>();
var subComponents2 = new List<Item>();
var componentSource = GetComponentSource(material, position);
switch (itemId)
{
case ItemID.Plank:
components.Add(new Item(position, ItemID.RawWood.ToString(), material.ToString()));
break;
case ItemID.Stick:
subComponents = CreateComponents(ItemID.Plank, material, position);
components.Add(new Item(position, ItemID.Plank.ToString(), subComponents));
break;
case ItemID.Bed:
subComponents = CreateComponents(ItemID.BedFrame, material, position);
subComponents2 = CreateComponents(ItemID.Mattress, material, position);
components.Add(new Item(position, ItemID.BedFrame.ToString(), subComponents));
components.Add(new Item(position, ItemID.Mattress.ToString(), subComponents2));
break;
case ItemID.FancyBed:
subComponents = CreateComponents(ItemID.FancyBedFrame, material, position);
subComponents2 = CreateComponents(ItemID.Mattress, material, position);
components.Add(new Item(position, ItemID.FancyBedFrame.ToString(), subComponents));
components.Add(new Item(position, ItemID.Mattress.ToString(), subComponents2));
break;
case ItemID.Bellows:
case ItemID.CrossbowStock:
case ItemID.Loom:
case ItemID.TrainingDummy:
case ItemID.Wheelbarrow:
case ItemID.Barrel:
case ItemID.BedFrame:
case ItemID.Crate:
case ItemID.FancyBedFrame:
case ItemID.WoodDoor:
case ItemID.WoodenShield:
subComponents = CreateComponents(ItemID.Plank, material, position);
for(var i = 0; i < 4; i++)
components.Add(new Item(position, ItemID.Plank.ToString(), subComponents));
break;
case ItemID.Dresser:
case ItemID.Cabinet:
case ItemID.Workbench:
subComponents = CreateComponents(ItemID.Plank, material, position);
for(var i = 0; i < 6; i++)
components.Add(new Item(position, ItemID.Plank.ToString(), subComponents));
break;
case ItemID.Torch:
subComponents = CreateComponents(ItemID.Stick, material, position);
components.Add(new Item(position, ItemID.Stick.ToString(), subComponents));
components.Add(new Item(position, ItemID.RawCoal.ToString(), Material.Coal.ToString()));
break;
case ItemID.Haft:
case ItemID.Hilt:
subComponents = CreateComponents(ItemID.Stick, material, position);
components.Add(new Item(position, ItemID.Stick.ToString(), subComponents));
break;
case ItemID.Block:
components.Add(new Item(position, ItemID.RawStone.ToString(), material.ToString()));
break;
case ItemID.Chisel:
case ItemID.Furnace:
case ItemID.Hearth:
case ItemID.Knife:
case ItemID.Mold:
case ItemID.PetRock:
case ItemID.Sawblade:
case ItemID.StoneDoor:
case ItemID.StoneHammer:
case ItemID.StoneHandAxe:
case ItemID.StoneKnifeBlade:
case ItemID.StoneSword:
case ItemID.Trough:
subComponents = CreateComponents(ItemID.Block, material, position);
components.Add(new Item(position, ItemID.Block.ToString(), subComponents));
break;
case ItemID.Pillar:
subComponents = CreateComponents(ItemID.Block, material, position);
for (var i = 0; i < 4; i++)
components.Add(new Item(position, ItemID.Block.ToString(), subComponents));
break;
case ItemID.Statue:
subComponents = CreateComponents(IsStone(material) ? ItemID.Block : ItemID.Bar, material, position);
for (var i = 0; i < 4; i++)
components.Add(NewItem(position, IsStone(material) ? ItemID.Block : ItemID.Bar, material, subComponents));
break;
case ItemID.Statuette:
subComponents = CreateComponents(IsStone(material) ? ItemID.Block : ItemID.Bar, material, position);
components.Add(NewItem(position, IsStone(material) ? ItemID.Block : ItemID.Bar, material, subComponents));
break;
case ItemID.Chair:
case ItemID.Table:
subComponents = CreateComponents(IsWood(material) ? ItemID.Plank : ItemID.Block, material, position);
for(var i = 0; i < 4; i++)
components.Add(new Item(position, IsWood(material) ? ItemID.Plank.ToString() : ItemID.Block.ToString(), subComponents));
break;
//.........这里部分代码省略.........
示例8: CreateComplexItem
private Item CreateComplexItem(ItemID itemId, Material material, Vector3 position)
{
Item newItem;
List<Item> components;
if (itemId == ItemID.Bag || itemId == ItemID.Barrel ||
itemId == ItemID.Crate || itemId == ItemID.Wheelbarrow)
{
components = CreateComponents(itemId, material, position);
newItem = new StorageContainer(position, itemId.ToString(), components) {CrafterHistory = creator.History};
}
else
{
components = CreateComponents(itemId, material, position);
if (components.Any())
{
newItem = new Item(position, itemId.ToString(), components) { CrafterHistory = creator.History };
}
else
{
newItem = new Item(position, itemId.ToString(), material.ToString());
}
}
GnomanEmpire.Instance.EntityManager.SpawnEntityImmediate(newItem);
GnomanEmpire.Instance.Fortress.AddItem(newItem);
RemoveComponents(components);
return newItem;
}
示例9: ChangeTurretColor
public void ChangeTurretColor(Material turret_color)
{
Turret_Head.renderer.material = turret_color;
//Debug.Log(turret_color.ToString());
GlobalVars.SetMaterial(turretNumber,turret_color.ToString().Replace(" (Instance) (UnityEngine.Material)", ""));
}