private void DealDamage(BrainController brainController) { var brainVariables = brainController.GetComponent <FightBrainVariables>(); FightBrain fightBrain = (FightBrain)brainController.currentBrain; var avatarStats = brainController.Stats; int crit = Random.value <= avatarStats.critChance ? 1 : 0; float damage = Random.Range(avatarStats.damage.x, avatarStats.damage.y) * (1 + crit * (avatarStats.critMultiplayer - 1)); fightBrain.TakeDamage(brainVariables.currentEnemy, damage, crit == 1); }
internal void ChangeBrains(TurnIntoClass turnIntoTarget) { // TODO: Check current brain and switch it to new. (Current brain hotSwitch) if (turnIntoTarget.idleBrain != null) { idleBrain = turnIntoTarget.idleBrain; } if (turnIntoTarget.fightBrain != null) { fightBrain = turnIntoTarget.fightBrain; } }
internal void RestoreBrains() { // TODO: Check current brain and switch it to new. (Current brain hotSwitch) idleBrain = oldIdleBrain; fightBrain = oldFightBrain; }
private void Start() { ChangeBrain(idleBrain); oldIdleBrain = idleBrain; oldFightBrain = fightBrain; }