void RandomizeClayxel(ClayObject clay) { ClayObjectRandomizationStrength strength = GetAddComponent <ClayObjectRandomizationStrength>(clay.gameObject); clay.transform.localPosition = RandomizeNonZeroOfVector3( clay.transform.localPosition, 0.25f * defaultStrength.all * defaultStrength.position * strength.all * strength.position); clay.transform.localEulerAngles = RandomizeNonZeroOfVector3( clay.transform.localEulerAngles, 5f * defaultStrength.all * defaultStrength.rotation * strength.all * strength.rotation); clay.transform.localScale = RandomizeVector3( clay.transform.localScale, 0.25f * defaultStrength.all * defaultStrength.scale * strength.all * strength.scale); clay.color = RandomizeColor( clay.color, 0.15f * defaultStrength.all * defaultStrength.color * strength.all * strength.color); clay.blend = RandomizeFloat( clay.blend, 0.1f * defaultStrength.all * defaultStrength.blend * strength.all * strength.blend); }
void InitDefaultStrength() { defaultStrength = GetComponent <ClayObjectRandomizationStrength>(); if (defaultStrength == null || !defaultStrength.enabled) { defaultStrength = gameObject.AddComponent <ClayObjectRandomizationStrength>(); } }