void SetWeaponPartAnimatorController() { // get weapon part color WeaponPartColors color = weaponPartColor; // if random pick a weapon part color if (color == WeaponPartColors.Random) { color = (WeaponPartColors)UnityEngine.Random.Range( 1, Enum.GetNames(typeof(WeaponPartColors)).Length); } // set color animator controller switch (color) { case WeaponPartColors.Blue: animator.runtimeAnimatorController = racWeaponPartBlue; break; case WeaponPartColors.Orange: animator.runtimeAnimatorController = racWeaponPartOrange; break; case WeaponPartColors.Red: animator.runtimeAnimatorController = racWeaponPartRed; break; } }
public void SetWeaponPartColor(WeaponPartColors color) { if (itemType == ItemTypes.WeaponPart) { weaponPartColor = color; SetWeaponPartAnimatorController(); } }