void Start() { goblinController = GetComponent<GoblinController>(); if (isCommon == true) { commonGoblin = RandCommonGoblin(); enemyName.GetComponent<TextMesh>().text = commonGoblin.name; goblinHealth = commonGoblin.maxHealth; healthScaleConstant = 0.01f / (goblinHealth / 100f); goblinFinalDamage = commonGoblin.goblinDamage; goblinFinalCSpeed = commonGoblin.chaseSpeed; goblinFinalMSpeed = commonGoblin.movementSpeed; goblinFinalAxeDamage = commonGoblin.axeDamage; goblinController.moveSpeed = goblinFinalMSpeed; goblinController.chaseSpeed = goblinFinalCSpeed; } else if (isSwift == true) { swiftGoblin = RandSwiftGoblin(); enemyName.GetComponent<TextMesh>().text = swiftGoblin.name; goblinHealth = swiftGoblin.maxHealth; healthScaleConstant = 0.01f / (goblinHealth / 100f); goblinFinalDamage = swiftGoblin.goblinDamage; goblinFinalCSpeed = swiftGoblin.chaseSpeed; goblinFinalMSpeed = swiftGoblin.movementSpeed; goblinFinalAxeDamage = swiftGoblin.axeDamage; goblinController.moveSpeed = goblinFinalMSpeed; goblinController.chaseSpeed = goblinFinalCSpeed; } else if (isStrong == true) { strongGoblin = RandStrongGoblin(); enemyName.GetComponent<TextMesh>().text = strongGoblin.name; goblinHealth = strongGoblin.maxHealth; healthScaleConstant = 0.01f / (goblinHealth / 100f); goblinFinalDamage = strongGoblin.goblinDamage; goblinFinalCSpeed = strongGoblin.chaseSpeed; goblinFinalMSpeed = strongGoblin.movementSpeed; goblinFinalAxeDamage = strongGoblin.axeDamage; goblinController.moveSpeed = goblinFinalMSpeed; goblinController.chaseSpeed = goblinFinalCSpeed; } }
StrongGoblinStats RandStrongGoblin() { StrongGoblinStats strongResult = new StrongGoblinStats(); strongResult.goblinDamage = (int)Mathf.Lerp(strongResult.goblinMinDamage, strongResult.goblinMaxDamage, Random.value); strongResult.movementSpeed = (int)Mathf.Lerp(strongResult.goblinMinSpeed, strongResult.goblinMaxSpeed, Random.value); strongResult.chaseSpeed = (int)Mathf.Lerp(strongResult.chaseMinSpeed, strongResult.chaseMaxSpeed, Random.value); strongResult.maxHealth = (int)Mathf.Lerp(strongResult.goblinMinHealth, strongResult.goblinMaxHealth, Random.value); strongResult.axeDamage = (int)Mathf.Lerp(strongResult.axeMinDamage, strongResult.axeMaxDamage, Random.value); return strongResult; }