void Start() { skeletonController = GetComponent<SkeletonController>(); if (isCommon == true) { commonSkeleton = RandCommonSkeleton(); enemyName.GetComponent<TextMesh>().text = commonSkeleton.name; skeletonHealth = commonSkeleton.maxHealth; healthScaleConstant = 0.01f / (skeletonHealth / 100f); skeletonFinalDamage = commonSkeleton.skeletonDamage; skeletonFinalCSpeed = commonSkeleton.chaseSpeed; skeletonFinalMSpeed = commonSkeleton.movementSpeed; skeletonController.moveSpeed = skeletonFinalMSpeed; skeletonController.chaseSpeed = skeletonFinalCSpeed; } else if (isSwift == true) { swiftSkeleton = RandSwiftSkeleton(); enemyName.GetComponent<TextMesh>().text = swiftSkeleton.name; skeletonHealth = swiftSkeleton.maxHealth; healthScaleConstant = 0.01f / (skeletonHealth / 100f); skeletonFinalDamage = swiftSkeleton.skeletonDamage; skeletonFinalCSpeed = swiftSkeleton.chaseSpeed; skeletonFinalMSpeed = swiftSkeleton.movementSpeed; skeletonController.moveSpeed = skeletonFinalMSpeed; skeletonController.chaseSpeed = skeletonFinalCSpeed; } else if (isStrong == true) { strongSkeleton = RandStrongSkeleton(); enemyName.GetComponent<TextMesh>().text = strongSkeleton.name; skeletonHealth = strongSkeleton.maxHealth; healthScaleConstant = 0.01f / (skeletonHealth / 100f); skeletonFinalDamage = strongSkeleton.skeletonDamage; skeletonFinalCSpeed = strongSkeleton.chaseSpeed; skeletonFinalMSpeed = strongSkeleton.movementSpeed; skeletonController.moveSpeed = skeletonFinalMSpeed; skeletonController.chaseSpeed = skeletonFinalCSpeed; } }
SwiftSkeletonStats RandSwiftSkeleton() { SwiftSkeletonStats swiftResult = new SwiftSkeletonStats(); swiftResult.skeletonDamage = (int)Mathf.Lerp(swiftResult.skeletonMinDamage, swiftResult.skeletonMaxDamage, Random.value); swiftResult.movementSpeed = (int)Mathf.Lerp(swiftResult.movementMinSpeed, swiftResult.movementMaxSpeed, Random.value); swiftResult.chaseSpeed = (int)Mathf.Lerp(swiftResult.chaseMinSpeed, swiftResult.chaseMaxSpeed, Random.value); swiftResult.maxHealth = (int)Mathf.Lerp(swiftResult.skeletonMinHealth, swiftResult.skeletonMaxHealth, Random.value); return swiftResult; }