// Use this for initialization void OnEnable() { BattleFight BF = AtkDamage.GetComponent <BattleFight> (); BF.enabled = true; BF.enabled = false; }
public void MercyMove() { Mercy MercyScript = MercyMoveScript.GetComponent <Mercy> (); GameObject item = GameObject.Find("ItemMove"); Item IScript = item.GetComponent <Item> (); GameObject act = GameObject.Find("ActMove"); Act Script = act.GetComponent <Act> (); BattleFight BF = AtkDamage.GetComponent <BattleFight> (); Attacks Attack = Attacks.GetComponent <Attacks> (); if (Spareable) { MercyScript.MercyTxt.color = yellow; } if (MercyScript.OnMercyMenu) { if (Input.GetAxisRaw("Cancel") == 1) { gameObject.transform.position = Mercy1.transform.position; Mercy1.enabled = true; Mercy1.interactable = true; MercyTxt.enabled = false; Mercy1.Select(); MainMenuTxt Main = GetComponent <MainMenuTxt> (); Main.MainMenTxt(); MercyScript.OnMercyMenu = false; Script.OnActMenuNmb = 0; IScript.OnItemMenu = false; } if (Input.GetAxisRaw("Submit") == 1) { if (IScript.NOfClicks > 1) { if (Spareable == false) { Attack.CancelSpawn = false; MercyScript.MercyTxt.enabled = false; Mercy1.enabled = true; Mercy1.enabled = false; Mercy1.interactable = false; MercyScript.OnMercyMenu = false; BF.enabled = true; BF.enabled = false; //Battle Fight works on Enable IScript.NOfClicks = 1; } else if (Spareable) { FadeToBlackAnim.Play("FadeToBlack"); } } } } }
protected override IEnumerator Run() { this._ui.battleOrderUI.SetTurnOrder(fighters); yield return(GameManager.Instance.time.GetController().StartCoroutine(this._ui.battleStartUI.PlayAnimation())); this._ui.targetIconsUI.ClearTargetArrows(); for (int i = 0; i < fighters.Count; i++) { if (fighters[i] == null) { // This can happen if the fighter dies mid-battle this._ui.battleOrderUI.PopFighter(); yield return(GameManager.Instance.time.GetController().WaitForSeconds(1.0f)); continue; } // Apply Status Ailment fighters[i].ailmentController.TickAilmentEffects(this._phase); if (queuedActions[i] == null) { Debug.LogError("ERROR: Queued action was null!"); } QueuedAction attackerAction = queuedActions[i]; // This can happen if target dies mid-battle if (attackerAction._action.TargetsDead(fighters[i], attackerAction.GetTargetIds())) { Debug.Log("Skip attacker's turn: " + fighters[i].Name); this._ui.battleOrderUI.PopFighter(); yield return(GameManager.Instance.time.GetController().WaitForSeconds(1.0f)); continue; } BattleFight fight = new BattleFight(_field, fighters[i], attackerAction, this._ui); this.currentFight = fight; yield return(GameManager.Instance.time.GetController().StartCoroutine(this._ui.focusOverlay.EnableOverlay())); yield return(GameManager.Instance.time.GetController().StartCoroutine(fight.DoFight())); yield return(GameManager.Instance.time.GetController().StartCoroutine(this._ui.focusOverlay.DisableOverlay())); this._ui.battleOrderUI.PopFighter(); } }
public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { _battleFight = battleFight; FightResult result = new FightResult(user, this); if (CheckCost(user)) { PayCost(user); targets = GetAllPossibleActiveTargets(user); Vector3 userStartingPos = user.transform.position; // Slide in if (animation != null && animation.slideType != SlideType.NONE) { yield return(GameManager.Instance.time.GetController().StartCoroutine(animation.SlideIn(user, targets))); } List <FightingEntity> potentialTargets = targets; for (int i = 0; i < _numHits; i++) { potentialTargets = targets.Filter(target => target != null); if (potentialTargets.Count == 0) { break; } List <FightingEntity> currTargets = SetTargets(user, targets); // Play animation GameManager.Instance.time.GetController().StartCoroutine(animation.AnimateAction(user, currTargets)); yield return(GameManager.Instance.time.GetController().WaitForSeconds(animation.GetAnimWindup(false))); result = ApplyEffect(user, currTargets); OnPostEffect(result); _battleFight.EndFight(result, this); yield return(GameManager.Instance.time.GetController().WaitForSeconds(animation.GetAnimCooldown(false))); } // Slide back if (animation != null && animation.slideType != SlideType.NONE) { yield return(GameManager.Instance.time.GetController().StartCoroutine(animation.Slide(user.transform, user.transform.position, userStartingPos))); } } }
public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { _battleFight = battleFight; FightResult result = new FightResult(user, this); if (CheckCost(user)) { PayCost(user); ActionBase selectedAction = _actions[Random.Range(0, _actions.Length)]; targets = selectedAction.GetNewTargets(user); // Play animation yield return(GameManager.Instance.time.GetController().StartCoroutine(selectedAction.PlayAnimation(user, targets))); result = selectedAction.ApplyEffect(user, targets); OnPostEffect(result); _battleFight.EndFight(result, this); yield return(GameManager.Instance.time.GetController().WaitForSeconds(selectedAction.animation.GetAnimCooldown())); } }
// Update is called once per frame public void OnEnable() { HeartMove Heart = HeartMov.GetComponent <HeartMove> (); HealthBar_Enemy HBarE = HBarEn.GetComponent <HealthBar_Enemy> (); Animator anim = Marciano.GetComponent <Animator>(); BattleFight BF = AtkDamage.GetComponent <BattleFight> (); Atk.SetBool("IsAttaking", false); Hit.Play(); AtkDamage.enabled = true; AtkDamageAnim.enabled = true; AtkDamageAnim.Play("AtkDamageAnim"); HealthBarHit.enabled = true; HealthBarHitDamaged.enabled = true; anim.Play("Quake"); anim.SetBool("QuakeEna", true); HBarE.EHealth -= Damage; AtkDamage.text = Damage.ToString(); //BF.enabled = false; }
public void ActText() { UITextTypeWriterName Nam = Name.GetComponent <UITextTypeWriterName> (); UITextTypeWriterDesc Des = Desc.GetComponent <UITextTypeWriterDesc> (); UITextTypeWriter x = xAct.GetComponent <UITextTypeWriter> (); GameObject act = GameObject.Find("ActMove"); Item IScript = ItemI.GetComponent <Item> (); Act Script = act.GetComponent <Act> (); Animator TxtAnim = TextBox.GetComponent <Animator> (); BattleFight BF = AtkDamage.GetComponent <BattleFight> (); if (Script.OnActMenuNmb == 0) { if (NameFinished) { xAct.enabled = true; x.ChangeText("*", 0f); Des.ChangeText(Des.text, 0f); Desc.enabled = true; NameFinished = false; } } }
public virtual IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { _battleFight = battleFight; FightResult result = new FightResult(user, this); Coroutine animationCor = null; if (CheckCost(user)) { PayCost(user); targets = SetTargets(user, targets); // Play animation yield return(GameManager.Instance.time.GetController().StartCoroutine(PlayAnimation(user, targets))); result = ApplyEffect(user, targets); OnPostEffect(result); _battleFight.EndFight(result, this); if (animation != null) { yield return(GameManager.Instance.time.GetController().WaitForSeconds(animation.GetAnimCooldown())); } } }
public void ItemTextPress() { BattleFight BF = AtkDamage.GetComponent <BattleFight> (); Item Script = ItemS.GetComponent <Item> (); if (Item1_2Finished) { if (Input.GetAxisRaw("Submit") == 1) { if (ItemTxtOn) { x1.enabled = false; x2.enabled = false; Item1_2.enabled = false; Item1_1.enabled = false; BF.enabled = true; BF.enabled = false; //Because it works with OnEnable. ItemTxtOn = false; Script.NOfClicks = 1; } } } }
public void ActTxtPress() { UITextTypeWriterName Nam = Name.GetComponent <UITextTypeWriterName> (); UITextTypeWriterDesc Des = Desc.GetComponent <UITextTypeWriterDesc> (); UITextTypeWriter x = xAct.GetComponent <UITextTypeWriter> (); GameObject act = GameObject.Find("ActMove"); Item IScript = ItemI.GetComponent <Item> (); Act Script = act.GetComponent <Act> (); Animator TxtAnim = TextBox.GetComponent <Animator> (); BattleFight BF = AtkDamage.GetComponent <BattleFight> (); //TalkBox TalkBox TalkBox = TextBox.GetComponent <TalkBox>(); if (ReadingAct) { if (DescFinished) { if (Input.GetAxisRaw("Submit") == 1) { Desc.enabled = false; //Desc in check x.enabled = false; //* in Desc(? xAct.enabled = false; //* in Name(? Name.enabled = false; //Name in check DescFinished = false; //If not works forever IScript.NOfClicks = 1; BF.enabled = true; BF.enabled = false; //Because it works with OnEnable. ReadingAct = false; TalkBox.TalkBoxTextString = "Ayy lmao."; } } else { if (Input.GetAxisRaw("Cancel") == 1) { Nam.StopAllCoroutines(); Des.StopAllCoroutines(); Name.text = Nam.text; Desc.enabled = true; xAct.enabled = true; Desc.text = Des.text; DescFinished = true; } } } if (ReadingDance) { if (Dance2Finished) { if (Input.GetAxisRaw("Submit") == 1) { IScript.NOfClicks = 1; Script.Dance_Text.enabled = false; Script.Dance_Text_2.enabled = false; Script.XDance_Text.enabled = false; Script.XDance_Text_2.enabled = false; Script.Suspense.enabled = false; Dance2Finished = false; BF.enabled = true; BF.enabled = false; ReadingDance = false; DanceNmb += 1; } } else { if (Input.GetAxisRaw("Cancel") == 1) { UITextTypeWriterSuspense SusType = Script.Suspense.GetComponent <UITextTypeWriterSuspense> (); UITextTypeWriterDance2 Dance2Type = Script.Dance_Text_2.GetComponent <UITextTypeWriterDance2> (); UITextTypeWriterDance DanceType = Script.Dance_Text.GetComponent <UITextTypeWriterDance> (); DanceType.StopAllCoroutines(); SusType.StopAllCoroutines(); Dance2Type.StopAllCoroutines(); IScript.NOfClicks = 1; Script.Dance_Text.enabled = true; Script.Dance_Text_2.enabled = true; Script.XDance_Text.enabled = true; Script.XDance_Text_2.enabled = true; Script.Suspense.enabled = true; Script.Dance_Text.text = DanceTxt; Script.Dance_Text_2.text = DanceTxt2; Script.Suspense.text = "..."; DanceNmb += 1; Script.XDance_Text.text = "*"; Script.XDance_Text_2.text = "*"; Dance2Finished = true; } } } }
public void FightMove() { Fight FightScript = FightMoveScript.GetComponent <Fight> (); Mercy MercyScript = MercyMoveScript.GetComponent <Mercy> (); FightBar FightB = FightBar.GetComponent <FightBar> (); SpriteRenderer spr = FightBar.GetComponent <SpriteRenderer> (); HitSound Hs = Attack_0.GetComponent <HitSound> (); BattleFight Bf = AtkDamage.GetComponent <BattleFight> (); GameObject item = GameObject.Find("ItemMove"); Item IScript = item.GetComponent <Item> (); GameObject act = GameObject.Find("ActMove"); Act Script = act.GetComponent <Act> (); Attacks Attack = Attacks.GetComponent <Attacks> (); Animator AtkDamageAnim = AtkDamage.GetComponent <Animator> (); Animator BgAnim = FightBg.GetComponent <Animator> (); if (Input.GetAxisRaw("Cancel") == 1) { if (FightScript.OnFightMenu) { gameObject.transform.position = Fight1.transform.position; Fight1.enabled = true; Fight1.interactable = true; Fight1.Select(); MainMenuTxt Main = GetComponent <MainMenuTxt> (); Main.MainMenTxt(); FightScript.OnFightMenu = false; Script.OnActMenuNmb = 0; IScript.OnItemMenu = false; xFight.enabled = false; FightName.enabled = false; HealthBar_Enemy.enabled = false; HealthBarDamaged_Enemy.enabled = false; } } if (Input.GetAxisRaw("Submit") == 1) { if (IScript.NOfClicks > 1) { if (FightScript.OnFightMenu) { Attack.CancelSpawn = false; xFight.enabled = false; FightName.enabled = false; HealthBar_Enemy.enabled = false; HealthBarDamaged_Enemy.enabled = false; PressFx.Play(); gameObject.SetActive(false); Fight1.enabled = true; Fight1.enabled = false; spr.enabled = true; Attacking = true; IScript.NOfClicks = 1; FightB.IsMoving = true; FightScript.OnFightMenu = false; Hs.enabled = false; Bf.enabled = false; BgAnim.enabled = true; FightBg.enabled = true; } } } }
public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { yield return(GameManager.Instance.time.GetController().StartCoroutine(base.ExecuteAction(user, targets, battleFight))); yield return(GameManager.Instance.time.GetController().StartCoroutine(base.ExecuteAction(user, targets, battleFight))); }
//Original Returns Int public JsonResult ChooseDefenders(int atkCardId, int[] defCardIds) { GameEngine engine = new GameEngine(Session); Battle battle = engine.Battle; Player atkPlayer = battle.Turn.Player; Player defPlayer = (battle.Turn.Player == battle.player1) ? battle.player2 : battle.player1; if (defCardIds.Count() > 2) { return(null); } if (battle.Phase != BattlePhase.Defense) { return(null); } //todo: deffend cards Carta atkCard = battle.Turn.Atackers.First(x => x.Id == atkCardId); if (defCardIds[0] == 0) { DirectHit(atkCardId); return(Json(new { atkId = atkCard.Id, atkIsDead = atkCard.IsDead, atkLife = atkCard.Defesa, defIds = 0, defIsDead = true, defLife = 0 })); } List <Carta> defCards = defPlayer.ChooseDefenders(defCardIds); BattleFight battleFight = new BattleFight(atkCard, defCards); var result = battleFight.Result; if (atkCard.IsDead) { atkPlayer.Graveyard.Add(atkCard); atkPlayer.AtackField.Remove(atkCard); } foreach (var defCard in defCards) { if (defCard.IsDead) { defPlayer.Graveyard.Add(defCard); defPlayer.DefenseField.Remove(defCard); } } defPlayer.Life -= result.PlayerLifeDamage; //todo: battleResult return(Json(new { atkId = result.Atacker.Id, atkIsDead = result.Atacker.IsDead, atkLife = result.Atacker.Defesa, defIds = result.Defender.Select(x => x.Id), defIsDead = result.Defender.Select(x => x.IsDead), defLife = result.Defender.Select(x => x.Defesa) })); }