public TheWaterArcanian(Vector2 position, PlayerIndex thePlayerIndex) : base(position, thePlayerIndex) { // Initialize texture texArcanianRight = "Arcanian/waterTurtleRight"; texArcanianLeft = "Arcanian/waterTurtleLeft"; texDyingRight = "Arcanian/waterTurtleDead_right"; texDyingLeft = "Arcanian/waterTurtleDead_left"; texShield = "Arcanian/watershieldsprite"; Texture = texArcanianRight; // Initialize name mName = "Water Arcanian"; // Initialize shield mShieldArt.SetTextureSpriteSheet(texShield, 4, 1, 0); mShieldArt.UseSpriteSheet = true; // Initliaze water skills SingleStream waterStream = new SingleStream(); DoubleWaterStream doubleWaterStream = new DoubleWaterStream(); UltimateWaterStream ultimateWaterStream = new UltimateWaterStream(); // Initialize skill set with water skills mSkillSet = new SkillSet(waterStream, doubleWaterStream, ultimateWaterStream, null); // Add skills to global list of skills //G.ListOfSkills.Add(waterStream); //G.ListOfSkills.Add(doubleWaterStream); //G.ListOfSkills.Add(ultimateWaterStream); // Initialize HP Regen mHPRegenTimer = 0; }
protected override IStream <TOut> CreateOutputStream(SubProcessArgs <TIn, TOut> args) { if (this.ExecutionContext is GetDefinitionExecutionContext) { var inputStream = new SingleStream <TIn>(this.Tracer.GetSubTraceMapper(this), this.ExecutionContext, this.NodeName, PushObservable.FromSingle(default(TIn))); var outputStream = args.SubProcess(inputStream); this.ExecutionContext.AddNode(this, outputStream.Observable, outputStream.TraceObservable); } Synchronizer synchronizer = new Synchronizer(args.NoParallelisation); var outputObservable = args.Stream.Observable .FlatMap(i => { EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); var inputStream = new SingleStream <TIn>(this.Tracer.GetSubTraceMapper(this), this.ExecutionContext, this.NodeName, PushObservable.FromSingle(i, waitHandle)); var outputStream = args.SubProcess(inputStream); this.ExecutionContext.AddNode(this, outputStream.Observable, outputStream.TraceObservable); IDisposable awaiter = null; outputStream.Observable.Subscribe(j => { }, () => awaiter?.Dispose()); return(new DeferredWrapperPushObservable <TOut>(outputStream.Observable, () => { awaiter = synchronizer.WaitBeforeProcess(); waitHandle.Set(); })); }); return(base.CreateUnsortedStream(outputObservable)); }
protected override IStream <TOut> CreateOutputStream(ToSubProcessesArgs <TIn, TOut> args) { // Semaphore semaphore = args.NoParallelisation ? new Semaphore(1, 1) : new Semaphore(10, 10); Synchronizer synchronizer = new Synchronizer(args.NoParallelisation); var outputObservable = args.Stream.Observable .FlatMap(i => PushObservable.FromEnumerable(args.SubProcesses.Select(sp => new { config = i, subProc = sp }))) .FlatMap(i => { EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); var inputStream = new SingleStream <TIn>(this.Tracer.GetSubTracer(this), this.ExecutionContext, this.NodeName, PushObservable.FromSingle(i.config, waitHandle)); var outputStream = i.subProc(inputStream); IDisposable awaiter = null; outputStream.Observable.Subscribe(j => { }, () => awaiter?.Dispose()); return(new DeferredWrapperPushObservable <TOut>(outputStream.Observable, () => { awaiter = synchronizer.WaitBeforeProcess(); waitHandle.Set(); })); // outputStream.Observable.Subscribe(j => { }, () => semaphore.Release()); // return new DeferredWrapperPushObservable<TOut>(outputStream.Observable, () => // { // semaphore.WaitOne(); // waitHandle.Set(); // }); }); return(base.CreateUnsortedStream(outputObservable)); }
protected override IStream <TOut> CreateOutputStream(GroupArgs <TIn, TKey, TOut> args) { if (this.ExecutionContext is GetDefinitionExecutionContext) { var inputStream = new SingleStream <TIn>(this.Tracer.GetSubTraceMapper(this), this.ExecutionContext, this.NodeName, PushObservable.FromSingle(default(TIn))); var outputStream = args.SubProcess(inputStream); this.ExecutionContext.AddNode(this, outputStream.Observable, outputStream.TraceObservable); } var outputObservable = args.Stream.Observable.Group(args.GetKey, iS => args.SubProcess(new Stream <TIn>(this.Tracer.GetSubTraceMapper(this), this.ExecutionContext, this.NodeName, iS)).Observable); return(base.CreateUnsortedStream(outputObservable)); }
protected override Skill MakeSkill(GamePadState playerController) { Skill newSkill = new Skill(); if (playerController.Buttons.A == ButtonState.Pressed) { newSkill = new SingleStream(); } else if (playerController.Buttons.B == ButtonState.Pressed) { newSkill = new DoubleWaterStream(); } else if (playerController.Buttons.Y == ButtonState.Pressed) { newSkill = new UltimateWaterStream(); } return newSkill; }