public HitBoxBuilder(AllServices allServices)
 {
     callbacks          = new Dictionary <string, Action <HitInfo> >();
     this.hitBoxService = allServices.GetService <IHitBoxService>();
     this.fgService     = allServices.GetService <IFightingGameService>();
     this.hitBoxPrefab  = this.hitBoxService.DefaultPrefab();
 }
            public void BuildAttack()
            {
                IHitBoxService hitBoxService = services.GetService <IHitBoxService>();

                builtFrameStates = new List <FrameState>();
                builtHitBoxes    = new List <HitBox>();

                Dictionary <int, HitBox> hitBoxMap = new Dictionary <int, HitBox>();

                foreach (KeyValuePair <int, Action <IHitBoxCallbackObject> > entry in hitBoxCallbackMap)
                {
                    Action <IHitBoxCallbackObject> callback = entry.Value;

                    HitBoxBuilder builder = new HitBoxBuilder(services);

                    callback(builder);
                    // TODO: Pass along the events

                    HitBox hitBox = builder.CreateHitBox(hitBoxService.GetEmptyHoldTransform());

                    hitBoxMap.Add(entry.Key, hitBox);
                    builtHitBoxes.Add(hitBox);
                }

                for (int n = 0; n < frames.Count; ++n)
                {
                    FrameStateBuilder frameStateBuilder = frames[n];
                    builtFrameStates.Add(frameStateBuilder.Build(hitBoxMap));
                }
            }
Example #3
0
 public void SetServices(IHitBoxService hitBoxService, IFightingGameService fgService)
 {
     this.hitBoxService = hitBoxService;
     this.fgService     = fgService;
 }