本文整理汇总了C#中ObjectGenerator类的典型用法代码示例。如果您正苦于以下问题:C# ObjectGenerator类的具体用法?C# ObjectGenerator怎么用?C# ObjectGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectGenerator类属于命名空间,在下文中一共展示了ObjectGenerator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Engine
public Engine()
{
this.objects = new List<EnvironmentObject>();
this.consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight);
this.objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight);
this.worldBounds = new Rectangle(0, 0, WorldWidth, WorldHeight);
CollisionHandler.Initlialize(WorldWidth, WorldHeight);
}
示例2: Start
void Start()
{
ladderLayer = LayerMask.NameToLayer("Ladder");
gameManager = GameManager.instance ;
objectGenerator = ObjectGenerator.instance;
objectManager = ObjectManager.instance;
targetSlot = objectManager.GetStartingSlot();
targetPosition = new Vector2(objectGenerator.IndexToGlobalPosition(targetSlot).x, -objectGenerator.horizon/2);
transform.position = targetPosition;
}
示例3: Start
// Use this for initialization
void Start()
{
objectHistory = InfiniteObjectHistory.instance;
objectManager = ObjectManager.instance;
objectGenerator = ObjectGenerator.instance;
inputController = InputController.instance;
objectManager.Init();
objectHistory.Init();
objectGenerator.Init();
objectGenerator.StartGame();
inputController.StartGame();
}
示例4: Run
public override void Run(string[] parameters)
{
string name = parameters[1];
int health = int.Parse(parameters[2]);
int damage = int.Parse(parameters[3]);
var factory = new ObjectGenerator();
var behavior = (AbstractBehavior)factory.Create(parameters[4], "Blobs.Behavior");
var attack = (AbstractAttack)factory.Create(parameters[5], "Blobs.Attack");
var blob = new Blob(name, health, damage, behavior, attack);
engine.Db.AddBlob(blob);
engine.Db.GetBlob(name).OutputMessage += engine.OnIncomingOutputMessage;
}
示例5: Main
public static void Main()
{
var objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight);
var consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight);
var collisionHandler = new CollisionHandler(WorldWidth, WorldHeight);
var engine = new EngineExtender(WorldWidth,
WorldHeight,
objectGenerator,
collisionHandler,
consoleRenderer);
engine.Run();
}
示例6: Main
static void Main()
{
var objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight);
var consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight);
var collisionHandler = new CollisionHandler(WorldWidth, WorldHeight);
var keyboardController = new KeyboardController();
var engine = new AdvancedEngine(keyboardController,
WorldWidth,
WorldHeight,
objectGenerator,
collisionHandler,
consoleRenderer);
engine.Run();
}
示例7: Main
static void Main()
{
var objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight);
var consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight);
var collisionHandler = new CollisionHandler(WorldWidth, WorldHeight);
var controller = new Controller();
controller.Pause += Controller_Pause;
var engine = new ExtendedEngine(WorldWidth,
WorldHeight,
objectGenerator,
collisionHandler,
consoleRenderer,
controller);
engine.Run();
}
示例8: DefaultSampleObjectFactory
// Default factory for sample objects
private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type)
{
// Try to create a default sample object
ObjectGenerator objectGenerator = new ObjectGenerator();
return objectGenerator.GenerateObject(type);
}
示例9: Start
void Start()
{
objectManager = ObjectManager.instance;
objectGenerator = ObjectGenerator.instance;
}
示例10: GetSampleObject
/// <summary>
/// Gets the sample object that will be serialized by the formatters.
/// First, it will look at the <see cref="SampleObjects"/>. If no sample object is found, it will try to create one using <see cref="ObjectGenerator"/>.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>The sample object.</returns>
public virtual object GetSampleObject(Type type)
{
object sampleObject;
if (!SampleObjects.TryGetValue(type, out sampleObject))
{
// Try create a default sample object
ObjectGenerator objectGenerator = new ObjectGenerator();
sampleObject = objectGenerator.GenerateObject(type);
}
return sampleObject;
}
示例11: TestSetup
public void TestSetup()
{
Mock<IEngineConfigurationType> type = new Mock<IEngineConfigurationType>();
type.SetupGet(x => x.RegisteredType).Returns(typeof(SimpleUser));
ObjectBuilder builder = new ObjectBuilder(type.Object);
builder.AddAction(
new ObjectPropertySetFromSourceAction(
ReflectionHelper.GetMember<SimpleUser>(x=>x.FirstName) as EngineTypePropertyMember,
new SimpleDataSource(mTestPropertyValue)
));
builder.AddAction(
new ObjectPropertySetFromSourceAction(
ReflectionHelper.GetMember<SimpleUser>(x => x.LastName) as EngineTypePropertyMember,
new SimpleDataSource(mTestPropertyValue)
));
builder.AddAction(
new ObjectPropertySetFromSourceAction(
ReflectionHelper.GetMember<SimpleUser>(x => x.EmailAddress) as EngineTypePropertyMember,
new SimpleDataSource(mTestPropertyValue)
));
Mock<IGenerationConfiguration> builderRepository = new Mock<IGenerationConfiguration>();
builderRepository.Setup(x=>x.GetBuilderForType(typeof(SimpleUser))).Returns(builder);
builderRepository.SetupGet(x => x.RecursionLimit).Returns(10);
mGenerationContext = new GenerationContext(builderRepository.Object);
mMethodGenerator = new ObjectGenerator<SimpleMethodClass>(
mGenerationContext, builder);
mUserGenerator = new ObjectGenerator<SimpleUser>(mGenerationContext, builder);
}
示例12: Awake
public void Awake()
{
instance = this;
}