コード例 #1
0
ファイル: Hand.cs プロジェクト: jpiv/RouglelikeCardGame
    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
ファイル: EnemyGroup.cs プロジェクト: jpiv/RouglelikeCardGame
    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
ファイル: Hand.cs プロジェクト: jpiv/RouglelikeCardGame
 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
ファイル: Character.cs プロジェクト: jpiv/RouglelikeCardGame
    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
ファイル: Hand.cs プロジェクト: jpiv/RouglelikeCardGame
    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
ファイル: Experience.cs プロジェクト: jpiv/RouglelikeCardGame
 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
ファイル: Character.cs プロジェクト: jpiv/RouglelikeCardGame
    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
ファイル: Character.cs プロジェクト: jpiv/RouglelikeCardGame
 public virtual float Attack()
 {
     this.OnAttackFinish = AnimationQueue.Add(
         () => this.animator.SetBool("Attack", true));
     return(0f);
 }
コード例 #20
0
ファイル: Character.cs プロジェクト: jpiv/RouglelikeCardGame
 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
ファイル: Level.cs プロジェクト: BasicLich/MizJam1-5
 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);
 }