本文整理汇总了C#中Component.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Component.SetProperty方法的具体用法?C# Component.SetProperty怎么用?C# Component.SetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component.SetProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public void Initialize()
{
BlankEntityFactory = () =>
{
var entity = new Entity();
var transform = new Component(GetPlugin(typeof(TransformComponent)));
transform.SetProperty("Width", new Value(48, true));
transform.SetProperty("Height", new Value(48, true));
entity.AddComponent(transform);
return entity;
};
ImageEntityFactory = () =>
{
var entity = new Entity();
entity.AddComponent(new Component(GetPlugin(typeof(ImageRenderComponent))));
return entity;
};
ShapeEntityFactory = () =>
{
var entity = new Entity();
var transform = new Component(GetPlugin(typeof(TransformComponent)));
transform.SetProperty("Width", new Value(48, true));
transform.SetProperty("Height", new Value(48, true));
entity.AddComponent(transform);
var render = new Component(GetPlugin(typeof(RenderComponent)));
render.SetProperty("Shape", new Value("Rectangle", true));
render.SetProperty("FillColor", new Value("Blue", true));
entity.AddComponent(render);
return entity;
};
TextEntityFactory = () =>
{
var entity = new Entity();
var text = new Component(GetPlugin(typeof(TextRenderComponent)));
text.SetProperty("FontSize", new Value(36, true));
text.SetProperty("FontColor", new Value("Black", true));
text.SetProperty("Value", new Value("Your Text Here", true));
entity.AddComponent(text);
return entity;
};
Statements.Add(new StatementFactory("If", StatementType.ConditionGroup, () => new ConditionGroup()));
Statements.Add(new StatementFactory("While Loop", StatementType.WhileLoop, () => new WhileLoop()));
Statements.Add(new StatementFactory("For Loop", StatementType.ForLoop, () => new ForLoop()));
Statements.Add(new StatementFactory("Change a Value", StatementType.Assignment, () => new Assignment()));
foreach (MethodInfo mi in typeof(Kinectitude.Core.Functions.Math).GetMethods().Where(mi => System.Attribute.IsDefined(mi, typeof(PluginAttribute))))
{
FunctionHolder.AddFunction(mi.Name, mi);
}
foreach (MethodInfo mi in typeof(Conversions).GetMethods().Where(mi => System.Attribute.IsDefined(mi, typeof(PluginAttribute))))
{
FunctionHolder.AddFunction(mi.Name, mi);
}
}