Beispiel #1
0
    //Only called from EndTurn(), waits for indicated length, then executes the enemy attack and begins the next turn.
    IEnumerator Reset(int amt)
    {
        //Wait for the indicated amount of time (seconds)
        yield return(new WaitForSeconds(amt));

        //Apply damage to the player, if there is any
        if (enemyAttack.damage != 0)
        {
            player.TakeDamage(enemyAttack.damage);
        }
        //Make sure the player didn't die
        if (player.playerData.health > 0)
        {
            //Add enemy shields, if there are any
            if (enemyAttack.gainShield != 0)
            {
                enemy.GainShields(enemyAttack.gainShield);
            }
            //Enemy attack over, discard all current cards and draw more
            DiscardAndDraw(5);
            //Get data on the next enemy attack
            enemyAttack = GetEnemyAttack(enemy);
            //Reset the back row damage bonus
            enemy.damageBonus = true;
            //Reset player energy
            player.UpdateEnergy(3);
            //Set player shields to 0
            player.UpdateShields(0);
            //Enable card interactability
            player.EnablePlay();
        }
    }
 private void Awake()
 {
     data         = GetComponent <Enemy>().data.attackData;
     Pivot        = GetComponentInChildren <EnemyPivot>().transform;
     cd           = 0;
     cdReady      = true;
     executeReady = true;
 }
 public void AddEnemyAttackData(EnemyAttack attack)
 {
     if (EnemyAttackData.ContainsKey(attack.Id))
     {
         return;
     }
     EnemyAttackData.Add(attack.Id, attack);
     EnemyAttackList.Add(attack);
 }
Beispiel #4
0
 //Called once player has picked their first row, starts the game
 public void Begin()
 {
     //Get data on the enemy's next attack
     enemyAttack = GetEnemyAttack(enemy);
     //Draw 5 cards
     DrawCards(5);
     //Enable card interaction
     player.EnablePlay();
 }
 public EnemyAttack GetAttack(int attackId)
 {
     if (EnemyAttackData.ContainsKey(attackId))
     {
         return(EnemyAttackData[attackId]);
     }
     else
     {
         return(null);
     }
 }
 public void TakeDamage(GameObject HitData)
 {
     //gets the hit data from the enemy that attacked the player
     attackData = HitData.GetComponent <EnemyAttackData>();
     //fills in variables with the values from the hit data
     DamageTaken = attackData.DamageValue;
     FlinchTaken = attackData.FlinchPower;
     //if the player perfect guarded the attack, sets the variables to 0
     if (PlayerControl.GuardedAttack == true && PlayerControl.PerfectGuardTime <= 0.3f)
     {
         DamageTaken = 0;
         FlinchTaken = 0;
         Debug.Log("Player Perfect Guarded");
     }
     //if the player normal guarded the attack, reduces the damage taken by half
     if (PlayerControl.GuardedAttack == true)
     {
         DamageTaken = DamageTaken / 2;
     }
     //checks if the amount of damage taken from a hit is more than zero
     if (DamageTaken > 0)
     {
         //removes health from the players current health based on how much damage they took
         PlayerHealth = PlayerHealth - DamageTaken;
         //checks if player has wave attack upgrade and removes it if so
         if (PlayerControl.WaveAttackActive == true)
         {
             PlayerControl.WaveAttackActive = false;
         }
         Debug.Log("Player Health: " + PlayerHealth);
         //checks the value for how much time the player should spend flinched from the attack
         if (FlinchTaken == 1)
         {
             PlayerControl.CanMove = false;
             StartCoroutine(ExitFlinchState(1f));
         }
         if (FlinchTaken >= 2)
         {
             PlayerControl.CanMove = false;
             StartCoroutine(ExitFlinchState(3f));
         }
     }
     PlayerControl.GuardedAttack = false;
 }