public void DrawCard() { CardType newCard = Deck.instance.DrawCard(); this.cardTypes.Add(newCard); AnimationQueue.Add(() => this.RenderHand(), 0); }
public void AoEAttack() { Hero.instance.Attack(); Hand.instance.FinishPlayCard(playedCard); this.nextDamage = this.playedCard.damage; foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.ExecuteEffects(Phases.PRE_ATTACK); } foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.AttackTarget(target, this.nextDamage, true, true); } // Buffer between all attack animations and card effects // Since attacks are all animated instantly in queue for AoE AnimationQueue.Add(() => {}, 1f); foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.ApplyCardEffects(target); this.ExecuteEffects(Phases.POST_ATTACK); } this.RemoveDefeated(); }
public List <Enemy> RemoveDefeated() { List <Enemy> enemiesToRemove = new List <Enemy>(); foreach (Enemy enemy in this.enemies) { if (enemy.GetHP() == 0) { enemiesToRemove.Add(enemy); } } ; foreach (Enemy enemy in enemiesToRemove) { this.RemoveEnemy(enemy); } float deathTimeout = 0.8f; List <Enemy> enemiesCopy = new List <Enemy>(this.enemies); AnimationQueue.Add(() => {}, deathTimeout); AnimationQueue.Add(() => { foreach (Enemy enemy in enemiesToRemove) { unity.Destroy(enemy.gameObject); } this.Reposition(enemiesCopy); }, 0); return(enemiesToRemove); }
public void SetHP(float hp) { this.hp = hp; float newShield = this.shield; AnimationQueue.Add(() => this.UpdateHealthBar(hp), 0f); }
public void SetShield(float shield) { this.shield = shield; float newHp = this.hp; AnimationQueue.Add(() => this.UpdateShieldBar(shield), 0f); }
public void CardSelection(int amount) { this.selectionMode = true; this.forceReset = true; this.selectionAmount = amount; AnimationQueue.Add(this.CreateCardSelection, 0f); }
// PLAYER_START phase public void StartPlayerTurn() { this.turn++; this.ExecuteEffects(Phases.PLAYER_START); Crystals.instance.Refresh(); Hand.instance.DrawHand(); AnimationQueue.Add(() => this.playerTurn = true, 0); }
public virtual void Heal(float amount) { float newHp = Mathf.Min(this.health.hp + amount, this.health.maxHealth); this.SetHP(newHp); AnimationQueue.Add(() => Creator.CreateHealAnimation(new Vector3(0.63f, -0.11f, -2), this.transform), 0); AnimationQueue.Add(() => this.CreateHealText(amount), 0f); }
public void RemoveBuff(int id) { this.buffs.RemoveAll(effect => effect.id == id); List <Effect> buffsCopy = new List <Effect>(this.buffs); float newHP = this.hp; float newShield = this.shield; AnimationQueue.Add(() => this.RenderBuffs(buffsCopy, newShield), 0f); }
public void AddBuff(Effect effect) { this.buffs.Add(effect); List <Effect> buffsCopy = new List <Effect>(this.buffs); float newHP = this.hp; float newShield = this.shield; AnimationQueue.Add(() => this.RenderBuffs(buffsCopy, newShield), 0f); }
private void QueueHandRender() { List <CardType> cardsCopy = new List <CardType>(this.cardTypes); AnimationQueue.Add(() => { this.isRendering = true; this.RenderHand(cardsCopy); }, 0f); AnimationQueue.Add(() => { this.isRendering = false; }, 0f); }
public static void Tick() { DI = Mathf.Min(DI + tick, maxDI); UpdateTickValue(); AnimationQueue.Add(() => { UpdateBar(); ApplyDebuffs(); }, 0f); time = Mathf.Min(time + 1, 14); }
public void FillAnimQueue(CombatResponse attack) { if (defenseQueue.Length() > 0) { CombatResponse defense = defenseQueue.Next(); bool victor = attack.Battle(defense); if (victor == WIN) { animQueue.Add(new AnimationBean(attack.AttackType, defense.AttackType, WIN, attack.Self.GetComponent <EnemyLogic>())); } else { animQueue.Add(new AnimationBean(attack.AttackType, defense.AttackType, LOSE, attack.Self.GetComponent <EnemyLogic>())); } } else { animQueue.Add(new AnimationBean(attack.AttackType, "nothing", LOSE, attack.Self.GetComponent <EnemyLogic>())); } }
private void LoseBattle() { if (this.gameOver) { return; } this.gameOver = true; AnimationQueue.Add(() => GameEndText.CreateText(this.gameEndAnimation, false, this.transform), 4f); AnimationQueue.Add(App.ResetGame, 0); }
public static void AddExp(int exp) { XP += exp; if (XP >= maxXP) { XP -= maxXP; LevelUp(); } UpdateTickValue(); AnimationQueue.Add(() => { UpdateBar(); }, 0f); }
private void WinBattle() { if (this.gameOver) { return; } this.gameOver = true; AnimationQueue.Add(() => GameEndText.CreateText(this.gameEndAnimation, true, this.transform), 4f); AnimationQueue.Add(() => { Hand.instance.DiscardHand(); WindowManager.ShowScreen(WindowManager.lootUI); }, 0); }
public virtual void TakeDamage(float damage, bool instant = false) { if (this.dead) { return; } float attackPause = instant ? 0f : 0.3f; float shieldDamage = this.health.shield - damage; this.SetShield(Mathf.Max(shieldDamage, 0f)); float newHp = Mathf.Max(this.health.hp + Mathf.Min(shieldDamage, 0f), 0f); this.SetHP(newHp); AnimationQueue.Add(() => this.CreateAttackAnimation(), 0.0f); AnimationQueue.Add(() => this.CreateDamageText(damage), attackPause); }
private void UpdateShieldBar(float newShield) { float shieldStartPos = this.shieldLine.GetPosition(0).x; float barEndPosition = shieldStartPos + (newShield / this.maxHealth) * (fullShieldPos.x - shieldStartPos); this.shieldLine.SetPosition(1, new Vector3(barEndPosition, this.fullShieldPos.y, this.fullShieldPos.z)); if (newShield != 0) { this.shieldText.GetComponent <TextMeshPro>().text = Mathf.Ceil(newShield).ToString(); } else { this.shieldText.GetComponent <TextMeshPro>().text = ""; } List <Effect> buffsCopy = new List <Effect>(this.buffs); HorizontalLayoutGroup hlg = this.buffBar.GetComponent <HorizontalLayoutGroup>(); LayoutRebuilder.ForceRebuildLayoutImmediate(this.buffBar.GetComponent <RectTransform>()); AnimationQueue.Add(() => this.RenderBuffs(buffsCopy, newShield), 0); }
public virtual float Attack() { this.OnAttackFinish = AnimationQueue.Add( () => this.animator.SetBool("Attack", true)); return(0f); }
public virtual void TriggerAttack() { this.OnAttackTriggers[0](); this.OnAttackTriggers.RemoveAt(0); this.OnAttackFinishs.Add(AnimationQueue.Add(() => {})); }
public void AddMana(int mana) { this.crystals += mana; AnimationQueue.Add(this.UpdateText, 0); }
public void Start() { IsGameOver = false; levelOver = false; loadLevel(); game.RecalculateCamera(); game.GameState = MizJam1Game.GameStates.FightPhase; animationQueue.Add(new ShowBannerAnimation(game.LevelStart, new Rectangle(736, 412, 448, 256), 2f), null); }
public void Refresh() { this.crystals = this.maxCrystals; AnimationQueue.Add(this.UpdateText, 0); }