protected override void OnCreateManager() { base.OnCreateManager(); Assert.IsFalse(float_resource_.IsCreated); float_resource_ = new AtomicFloatResource(1024, Allocator.Persistent); random_ = RandomMaker.create(); stopwatch_ = new System.Diagnostics.Stopwatch(); stopwatch_.Start(); }
void OnEnable() { TimeSystem.Ignite(); var entity_manager = World.Active.GetOrCreateManager <EntityManager>(); var arche_type = entity_manager.CreateArchetype(typeof(SparkTestDummy), typeof(RandomLocal)); var entity = entity_manager.CreateEntity(arche_type); entity_manager.SetComponentData(entity, RandomMaker.create()); }
static void Init() { /* * work around of TOO MUCH stripping. */ new Unity.Rendering.MeshInstanceRendererSystem(); new Unity.Transforms.EndFrameTransformSystem(); new Unity.Rendering.MeshRenderBoundsUpdateSystem(); new Unity.Rendering.RenderingSystemBootstrap(); /**/ // TypeManager.GetTypeIndex(typeof(Locked)); RandomMaker.initialize(12345L); }
private IEnumerator act() { var random = RandomMaker.create(); for (;;) { float time = random.range(0.5f, 1f); float dir = (float)((int)random.range(0f, 8f)) * Mathf.PI * 0.25f; int prev_fire = 0; for (var i = new WaitForSeconds(time, Time.GetCurrent()); !i.end(Time.GetCurrent());) { auto_pc_.fire_laser_ = 0; auto_pc_.fire_bullet_ = 0; auto_pc_.lockon_ = 0; auto_pc_.horizontal_ = math.cos(dir) * 128f; auto_pc_.vertical_ = math.sin(dir) * 128f; if (random.probabilityForSecond(1f, Time.GetDT())) // release { auto_pc_.fire_laser_ = 1; prev_fire = 0; } else // press { auto_pc_.lockon_ = 1; if (prev_fire == 0) { auto_pc_.fire_bullet_ = 1; prev_fire = 1; } } if (random.probabilityForSecond(0.6f, Time.GetDT())) { auto_pc_.roll_ = random.range(-1, 2); } yield return(null); } } }
protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); random_ = RandomMaker.create(); enumerator_ = act(); }