예제 #1
0
    public void DrawCard()
    {
        CardType newCard = Deck.instance.DrawCard();

        this.cardTypes.Add(newCard);
        AnimationQueue.Add(() => this.RenderHand(), 0);
    }
예제 #2
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();
 }
예제 #3
0
    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);
    }
예제 #4
0
    public void SetHP(float hp)
    {
        this.hp = hp;
        float newShield = this.shield;

        AnimationQueue.Add(() => this.UpdateHealthBar(hp), 0f);
    }
예제 #5
0
    public void SetShield(float shield)
    {
        this.shield = shield;
        float newHp = this.hp;

        AnimationQueue.Add(() => this.UpdateShieldBar(shield), 0f);
    }
예제 #6
0
 public void CardSelection(int amount)
 {
     this.selectionMode   = true;
     this.forceReset      = true;
     this.selectionAmount = amount;
     AnimationQueue.Add(this.CreateCardSelection, 0f);
 }
예제 #7
0
 // 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);
 }
예제 #8
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);
    }
예제 #9
0
    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);
    }
예제 #10
0
    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);
    }
예제 #11
0
    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);
    }
예제 #12
0
 public static void Tick()
 {
     DI = Mathf.Min(DI + tick, maxDI);
     UpdateTickValue();
     AnimationQueue.Add(() => {
         UpdateBar();
         ApplyDebuffs();
     }, 0f);
     time = Mathf.Min(time + 1, 14);
 }
예제 #13
0
 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>()));
     }
 }
예제 #14
0
 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);
 }
예제 #15
0
 public static void AddExp(int exp)
 {
     XP += exp;
     if (XP >= maxXP)
     {
         XP -= maxXP;
         LevelUp();
     }
     UpdateTickValue();
     AnimationQueue.Add(() => {
         UpdateBar();
     }, 0f);
 }
예제 #16
0
 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);
 }
예제 #17
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);
    }
예제 #18
0
    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);
    }
예제 #19
0
 public virtual float Attack()
 {
     this.OnAttackFinish = AnimationQueue.Add(
         () => this.animator.SetBool("Attack", true));
     return(0f);
 }
예제 #20
0
 public virtual void TriggerAttack()
 {
     this.OnAttackTriggers[0]();
     this.OnAttackTriggers.RemoveAt(0);
     this.OnAttackFinishs.Add(AnimationQueue.Add(() => {}));
 }
예제 #21
0
 public void AddMana(int mana)
 {
     this.crystals += mana;
     AnimationQueue.Add(this.UpdateText, 0);
 }
예제 #22
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);
 }
예제 #23
0
 public void Refresh()
 {
     this.crystals = this.maxCrystals;
     AnimationQueue.Add(this.UpdateText, 0);
 }