Exemple #1
0
 private void Update()
 {
     if (player == null)
     {
         player = storyManager.GetPlayerCharacter();
         if (player == null)
         {
             return;
         }
         else
         {
             unlockButton.SetPlayer(player);
             mainMenuButton.SetActive(true);
         }
     }
     classLabel.text = player.GetClass();
     levelLabel.text = $"{player.GetLevel()}";
     skillLabel.text = $"{player.GetSkillPoints()}";
 }
 private void Update()
 {
     if (player == null)
     {
         player = storyManager.GetPlayerCharacter();
     }
     if (player == null)
     {
         return;
     }
     else
     {
         (string name, int value) = player.GetStat(stat);
         text.text = $"{name}\n{value}";
     }
 }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        if (attackQueue == null)
        {
            attackQueue = new Queue <Fighter>();
        }
        if (player == null)
        {
            player = manager.GetPlayerCharacter();
        }
        if (player == null)
        {
            return;
        }

        if (pause)
        {
            player.IsFighting = false;
            if (enemies == null)
            {
                return;
            }
            foreach (Enemy enemy in enemies)
            {
                enemy.IsFighting = false;
            }
        }
        else
        {
            player.IsFighting = true;
            foreach (Enemy enemy in enemies)
            {
                enemy.IsFighting = true;
            }
        }

        if (AllEnemiesDead() && !someoneIsAttacking)
        {
            cam.ChangeToFirstPerson();
            pause = true;
        }
        if (AllEnemiesDead() && !someoneIsAttacking && cam.PositionSet)
        {
            HandleBattleOver();
            pause = true;
        }
        if (player != null && player.IsDead())
        {
            StartCoroutine(DoDeathCam(1.5f));
        }

        if (!someoneIsAttacking && attackQueue.Count > 0 && !BattleOver)
        {
            currentAttacker = attackQueue.Dequeue();
            if (!currentAttacker.IsDead())
            {
                SomeoneGotHit      = false;
                someoneIsAttacking = true;

                foreach (Enemy enemy in enemies)
                {
                    enemy.PauseInitiativeTimer(true);
                }
                player.PauseInitiativeTimer(true);

                if (currentAttacker == player)
                {
                    attackOptionsPanel.Flush();
                    foreach (PlayerMove attack in player.GetAvailableMoves())
                    {
                        Instantiate(attackOptionPrefab, attackOptionsPanel.transform).
                        Init(attack, description, player);
                    }
                    player.Attack();
                }
                else
                {
                    currentAttacker.Attack();
                }
            }
        }
    }