You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/ThirteenPixels/Placr/Editor/Modifiers/PlacrModifierRandomScale.cs

28 lines
826 B
C#

// Copyright © Sascha Graeff/13Pixels.
namespace ThirteenPixels.Placr
{
using UnityEngine;
public class PlacrModifierRandomScale : PlacrModifierBase
{
public override string title => "Random Scale";
[SerializeField]
private Vector3 min = new Vector3(0.9f, 0.9f, 0.9f);
[SerializeField]
private Vector3 max = new Vector3(1.1f, 1.1f, 1.1f);
[SerializeField]
private bool sameHorizontalValue = true;
public override void ApplyTo(GameObject gameObject)
{
var x = Random.Range(min.x, max.x);
var y = Random.Range(min.y, max.y);
var z = sameHorizontalValue ? x : Random.Range(min.z, max.z);
var scale = new Vector3(x, y, z);
gameObject.transform.localScale = scale;
}
}
}