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();
 }
Exemple #2
0
            public void BuildAttack(AllServices services)
            {
                fgService   = services.GetService <IFightingGameService>();
                projectServ = services.GetService <IProjectileService>();
                audioServ   = services.GetService <IAudioService>();

                fgChar = services.GetService <IBuildService>().GetBuildingFGChar();

                AttackBuilder attackBuilder = new AttackBuilder(services);

                builderCallback(attackBuilder);

                attackBuilder.BuildAttack();

                name           = attackBuilder.name;
                orientation    = attackBuilder.orientation;
                groundRelation = attackBuilder.groundRelation;
                input          = attackBuilder.input;
                priority       = 1;
                animStateName  = attackBuilder.animStateName;

                frames   = attackBuilder.GetFrames();
                hitBoxes = attackBuilder.GetHitBoxes();

                tracker = new AttackTracker(frames.Count);
            }
            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));
                }
            }
Exemple #4
0
 public Attacks(AllServices services, Dictionary <string, AudioClip> audioMap)
 {
     audioService      = services.GetService <IAudioService>();
     projectileService = services.GetService <IProjectileService>();
     this.audioMap     = audioMap;
 }