public CharacterStats(PlayerDatabaseConn dbConn)
 {
     health         = dbConn.GETPlayerHealth();
     maxHealth      = health;
     moveSpeed      = dbConn.GETPlayerMoveSpeed();
     attackDamage   = dbConn.GETPlayerAttackDamage();
     attackRange    = dbConn.GETPlayerAttackRange();
     attackCooldown = dbConn.GETPlayerAttackCooldown();
 }
Пример #2
0
        private void Awake()
        {
            gameStateController = GameObject.Find("GameStateController").GetComponent <GameStateController>().GetInstance();

            characterMovement = GetComponent <CharacterMovement>();
            characterMovement.SetRigidBody2D(GetComponent <Rigidbody2D>());
            characterMovement.SetCharacterAnimationController(GetComponentInChildren <CharacterAnimationController>());
            DBConn         = new PlayerDatabaseConn();
            characterStats = new CharacterStats(DBConn);
            healthBar.SetMaxHealth(characterStats.GETHealth());

            SetUpPlayerAttackController();

            if (gameStateController != null && gameStateController.isLoadedFromSave)
            {
                characterStats.SetHealth(gameStateController.playerHealth);
                m_NextFireAttack = Time.time + gameStateController.fireCooldown;
                fireCooldown.StartCoroutine(fireCooldown.CooldownFillTime(gameStateController.fireCooldown));
                m_NextRangedAttack = Time.time + gameStateController.windCooldown;
                rangedCooldown.StartCoroutine(rangedCooldown.CooldownFillTime(gameStateController.windCooldown));
                m_NextDefensiveAbility = Time.time + gameStateController.earthCooldown;
                defensiveCooldown.StartCoroutine(defensiveCooldown.CooldownFillTime(gameStateController.earthCooldown));
                m_NextHealingAbility = Time.time + gameStateController.waterCooldown;
                healingCooldown.StartCoroutine(healingCooldown.CooldownFillTime(gameStateController.waterCooldown));
                healthBar.SetHealth(gameStateController.playerHealth);
            }
            if (gameStateController != null && gameStateController.isTransition)
            {
                characterStats.SetHealth(gameStateController.playerHealth);
                playerAttackController.setFireAttackDamage(gameStateController.fireDamage);
                playerAttackController.setRangedAttackDamage(gameStateController.windDamage);
                playerAttackController.setDefenseDamageReduction(gameStateController.earthDamageReduction);
                playerAttackController.setHealingAmount(gameStateController.waterHealingAmount);
                healthBar.SetHealth(gameStateController.playerHealth);
            }
            isDead = false;
        }