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 StartCharacterBuild(Action <FightingGameCharacter> fgCharCallback = null) { foreach (KeyValuePair <int, ICharacterBuilder> charBuilder in selectedFGChars) { int playerId = charBuilder.Key; FightingGameCharacter builtFGChar = buildService.Build(charBuilder.Value); fgChars.Add(playerId, builtFGChar); HumanInputController humanInputController = inputService.GetInputController(playerId); if (humanInputController != null) { humanInputController.ConnectToCharacter(builtFGChar); } fgCharCallback?.Invoke(builtFGChar); } foreach (KeyValuePair <int, FightingGameCharacter> curr in fgChars) { List <FightingGameCharacter> othersList = new List <FightingGameCharacter>(); foreach (KeyValuePair <int, FightingGameCharacter> other in fgChars) { if (curr.Value != other.Value) { othersList.Add(other.Value); } } otherChars.Add(curr.Key, othersList); } }
public FightingGameCharacter CreateCharacter(AllServices services) { GameObject character = Instantiate <GameObject>(male0Prefab, transform.position, transform.rotation); character.name = male0Prefab.name; fgChar = character.GetComponent <FightingGameCharacter>(); return(fgChar); }
public void Init(ICharacterPropertiesCallbackObj charBuilder, FightingGameCharacter fgChar) { charBuilder .WalkSpeed(1.0f) .RunSpeed(charState => { return(2.0f); }) .MaxJumpHeight(1.0f); }
public void Start() { FightingGameCharacter char0 = buildService.Build(male0Builder0.GetComponent <ICharacterBuilder>()); FightingGameCharacter char1 = buildService.Build(male0Builder1.GetComponent <ICharacterBuilder>()); char0.charVelocity = charVelocity; char0.SetInputBuffer(inputBuffer); EventManager.TriggerEvent <ResonantSpark.Events.FightingGameCharsReady>(); }
public void SetUpCharacter(FightingGameCharacter fgChar) { CharacterData charData = ScriptableObject.CreateInstance <CharacterData>(); charData.Init(this.maxHealth); BuildAttacks(charData); //BuildMovement(charData); fgChar.Init(charData); }
public void Awake() { inputCallbacks = new Dictionary <Type, Action <Action, Combination> >(); enterCallbacks = new Dictionary <Type, Action <Action, Combination> >(); inputRegistry = new CallbackRegistry(inputCallbacks); enterRegistry = new CallbackRegistry(enterCallbacks); stopInputSearch = new Action(StopInputSearch); states = gameObject.GetComponentInParent <StateDict>(); fgChar = gameObject.GetComponentInParent <FightingGameCharacter>(); frame = GameObject.FindGameObjectWithTag("rspTime").GetComponent <FrameEnforcer>(); }
public void SetUp(PlayerService playerService, FightingGameService fgService, UiService uiService) { this.playerService = playerService; this.fgService = fgService; this.uiService = uiService; char0 = playerService.GetFGChar(0); char1 = playerService.GetFGChar(1); char0.SetOpponentCharacter(char1); char1.SetOpponentCharacter(char0); char0.RegisterOnHealthChangeCallback(OnPlayerHealthChange(0)); char1.RegisterOnHealthChangeCallback(OnPlayerHealthChange(1)); char0.RegisterOnEmptyHealthCallback(OnPlayerEmptyHealth); char1.RegisterOnEmptyHealthCallback(OnPlayerEmptyHealth); }
public void Awake() { fgChar = gameObject.GetComponentInParent <FightingGameCharacter>(); frame = GameObject.FindGameObjectWithTag("rspTime").GetComponent <FrameEnforcer>(); }
public void Init(ICharacterPropertiesCallbackObj charBuilder, FightingGameCharacter fgChar) { Attack atkReg5A = new Attack(atkBuilder => { atkBuilder .Name("regular_5A") .Orientation(Orientation.REGULAR) .GroundRelation(GroundRelation.GROUNDED) .Input(InputNotation._5A) .AnimationState("regular_5A") .Frames( FrameUtil.CreateList(f => { f .SpecialCancellable(true) .ChainCancellable(false) .From(1) .HitBox() .To(8) .From(8) .HitBox(h => { h.Relative(fgChar.transform); h.Point0(new Vector3(0, 0, 0)); h.Point1(new Vector3(0, 1, 0)); h.Radius(0.25f); h.Event("onHurtBox", (hitInfo) => { if (hitInfo.hitEntity != fgChar) { Debug.Log("Regular 5A hit enemey"); audioService.PlayOneShot(hitInfo.position, audioMap["regular_5A"]); Debug.Log("Regular 5A Hit"); // TODO: audioService.Play("male0_regular_5AA") // .At(hitInfo.position); or .Follow(/*supply a trasform*/); // change it to -> audioService.Play(soundMap.Get("regular_5A")); hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); }) .HitDamage(800) .BlockDamage(0) .HitStun(20.0f) .BlockStun(10.0f) .To(10) .From(10) .HitBox() .ChainCancellable(true) .To(22); }) ); }); Attack atkReg5AA = new Attack(atkBuilder => { atkBuilder .Name("regular_5AA") .Orientation(Orientation.REGULAR) .GroundRelation(GroundRelation.GROUNDED) .Input(InputNotation._5A) .AnimationState("regular_5AA") .Frames( FrameUtil.CreateList(f => { f .SpecialCancellable(true) .From(1) .HitBox() .ChainCancellable(false) .To(12) .From(10) .ChainCancellable(true) .From(12) // This is a possible way to program the configuration code. I think this has its merits, // but having damage values statically defined also has its benefits //.HitBox(h => { // h.Point0(new Vector3(0, 0, 0)); // h.Point1(new Vector3(0, 1, 0)); // h.Radius(0.25f); // h.Event("onHurtBox", (fgChar) => { // Debug.Log("Regular 5AA hit the enemy"); // // TODO: Figure out what to do with these events // fgChar.Hit(hitDamage: 800, blockDamage: 0, hitStun: 20.0f, blockStun: 10.0f); // }); // h.Event("onHitBox", (fgChar) => { // Debug.Log("Regular 5AA hit another hitbox"); // // TODO: Figure out what to do with these events // }); //}) .HitBox(h => { h.Relative(fgChar.gameObject.transform); h.Point0(new Vector3(0, 0, 0)); h.Point1(new Vector3(0, 1, 0)); h.Radius(0.25f); h.Event("onHurtBox", (hitInfo) => { Debug.Log("Regular 5AA hit the enemy"); // TODO: audioService.Play("male0_regular_5AA") // .At(hitInfo.position); or .Follow(/*supply a trasform*/); // change it to -> audioService.Play(soundMap.Get("regular_5A")); if (hitInfo.hitEntity != fgChar) { hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); h.Event("onHitBox", (hitInfo) => { Debug.Log("Regular 5AA hit another hitbox"); // TODO: audioService.Play("male0_regular_5AA") // .At(hitInfo.position); or .Follow(/*supply a trasform*/); // change it to -> audioService.Play(soundMap.Get("regular_5A")); if (hitInfo.hitEntity != fgChar) { hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); }) .HitDamage(1000) .BlockDamage(10) .HitStun(30.0f) .BlockStun(12.0f) .To(10) //.To(14) .From(14) .HitBox() .To(30); }) ); }); Attack atkGfy5A = new Attack(atkBuilder => { atkBuilder .Name("goofy_5A") .Orientation(Orientation.GOOFY) .GroundRelation(GroundRelation.GROUNDED) .Input(InputNotation._5A) .AnimationState("goofy_5A") .Frames( FrameUtil.CreateList(f => { f .SpecialCancellable(true) .From(1) .HitBox() .ChainCancellable(false) .To(8) .From(6) .ChainCancellable(true) .From(8) .HitBox(h => { h.Relative(fgChar.gameObject.transform); h.Point0(new Vector3(0, 0, 0)); h.Point1(new Vector3(0, 1, 0)); h.Radius(0.25f); h.Event("onHurtBox", (hitInfo) => { Debug.Log("Goofy 5A hit the enemy"); // TODO: audioService.Play("male0_goofy_5A") // .At(hitInfo.position); or .Follow(/*supply a trasform*/); // change it to -> audioService.Play(soundMap.Get("regular_5A")); if (hitInfo.hitEntity != fgChar) { hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); }) .HitDamage(800) .BlockDamage(50) .HitStun(20.0f) .BlockStun(10.0f) .To(10) .From(10) .HitBox() .To(16); }) ); }); Attack atkGfy5AA = new Attack(atkBuilder => { atkBuilder .Name("goofy_5AA") .Orientation(Orientation.GOOFY) .GroundRelation(GroundRelation.GROUNDED) .Input(InputNotation._5A) .AnimationState("goofy_5AA") .Frames( FrameUtil.CreateList(f => { f .SpecialCancellable(true) .From(1) .HitBox() .ChainCancellable(false) .To(12) .From(10) .ChainCancellable(true) .From(12) .HitBox(h => { h.Relative(fgChar.gameObject.transform); h.Point0(new Vector3(0, 0, 0)); h.Point1(new Vector3(0, 1, 0)); h.Radius(0.25f); h.Event("onHurtBox", (hitInfo) => { Debug.Log("Goofy 5AA hit the enemy"); // TODO: audioService.Play("male0_goofy_5AA") // .At(hitInfo.position); or .Follow(/*supply a trasform*/); // change it to -> audioService.Play(soundMap.Get("regular_5A")); if (hitInfo.hitEntity != fgChar) { hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); }) .To(14) .From(14) .HitBox() .To(20); }) ); }); Attack atkGfy5AAh = new Attack(atkBuilder => { atkBuilder .Name("goofy_5A[A]") .Orientation(Orientation.GOOFY) .GroundRelation(GroundRelation.GROUNDED) .Input(InputNotation._5Ah) .AnimationState("goofy_5A[A]") .Frames( FrameUtil.CreateList(f => { f .SpecialCancellable(true) .From(1) .HitBox() .ChainCancellable(false) .To(12) .From(10) .ChainCancellable(true) .From(12) .HitBox(h => { h.Relative(fgChar.gameObject.transform); h.Point0(new Vector3(0, 0, 0)); h.Point1(new Vector3(0, 1, 0)); h.Radius(0.25f); h.Event("onHurtBox", (hitInfo) => { Debug.Log("Goofy 5A[A] hit the enemy"); // TODO: Figure out what to do with these events if (hitInfo.hitEntity != fgChar) { hitInfo.hitEntity.GetHitBy(hitInfo.hitBox); } }); }) .To(14) .From(14) .HitBox() .To(20); }) ); }); //Attack hadouken = new Attack(atkBuilder => { atkBuilder // .Name("hadouken") // .Orientation(Orientation.REGULAR) // .GroundRelation(GroundRelation.GROUNDED) // .Input(InputNotation._5A) // .AnimationState("crouch_to_stand") // .Frames( // FrameUtil.CreateList(f => { f // .SpecialCancellable(false) // .ChainCancellable(false) // .From(1) // .HitBox() // .From(3) // .Sound(audioMap["hadouken"], soundResource => { // soundResource.transform.position = fgChar.transform.position; // audioService.Play(soundResource); // }) // .Sound(audioMap["hadouken"]) // .From(12) // .Projectile(projectileMap["hadouken"], proj => { // projectileService.FireProjectile(proj.id); // }) // .To(46); // }) // ); //}); charBuilder .Attack(atkReg5A, (charState, currAttack) => { //if (charState.activeAttack == null || // charState.activeAttack == charState.Notation(InputNotation._2A, Orientation.REGULAR, GroundRelation.CROUCH)) { // or // charState.activeAttack == charState.Name("regular_2A")) { // return true; //} if (currAttack == null) { return(true); } return(false); }) .Attack(atkReg5AA, (charState, currAttack) => { if (currAttack == atkReg5A) { return(true); } return(false); }) .Attack(atkGfy5A, (charState, currAttack) => { //if (charState.activeAttack == null || // charState.activeAttack == charState.Notation(InputNotation._2A, Orientation.GOOFY, GroundRelation.CROUCH)) { // return true; //} if (currAttack == null) { return(true); } return(false); }) .Attack(atkGfy5AA, (charState, currAttack) => { if (currAttack == atkGfy5A) { return(true); } return(false); }) .Attack(atkGfy5AAh, (charState, currAttack) => { if (currAttack == atkGfy5A) { return(true); } return(false); }); //.Attack(hadouken, (charState, currAttack) => { // if (currAttack == null) { // return true; // } // return false; //}); //charBuilder.Adapter("1.0", "1.2", new Version1_2Adapter()); }
public Vector2 ScreenOrientation(FightingGameCharacter fgChar) { return(camera.ScreenOrientation(fgChar.transform)); }
public void ConnectToCharacter(FightingGameCharacter fgChar) { fgChar.SetInputBuffer(inputBuffer); }
public FightingGameCharacter Build(ICharacterBuilder charBuilder) { currFGChar = charBuilder.CreateCharacter(services); charBuilder.Build(services); return(currFGChar); }
private void OnPlayerEmptyHealth(FightingGameCharacter fgChar) { // TODO: this might result in a race condition that needs to be resolved for double K.O.s EndRound(); }
public void Start() { fgChar = GetComponentInParent <FightingGameCharacter>(); hurtBox = LayerMask.NameToLayer("HurtBox"); hitBox = LayerMask.NameToLayer("HitBox"); }