public void Init(PlantCreator.FlowerType type, float size, PlantCreator.FlowerType subType = PlantCreator.FlowerType.None) { m_size = size; m_FlowerType = type; m_FlowerSubType = subType; var item = PlantCreator.Instance.GetFlowerItem(type); target.GetComponent <SpriteRenderer>().color = item.color; m_state = State.Show; PlayShowUpAnimation(target, showUpDuration, true, 0.2f); }
public void Init(PlantCreator.FlowerType type, Vector3 initDir, float size, PlantBase parent, float invRadius = 0, PlantCreator.FlowerType subType = PlantCreator.FlowerType.None) { base.Init(parent); m_FlowerType = type; m_FlowerSubType = subType; m_size = size; m_lifeTime = lifeTime.Rand; lifeTimer = 0; m_speed = speed.Rand; velocity = initDir.normalized * m_speed; if (invRadius != 0) { m_InvRadius = invRadius; } else { m_InvRadius = 1f / ((Random.RandomRange(0, 1f) > 0.5f ? 1f : -1f) * initRadius.Rand); } m_height = height * size; oriInvRadius = temInvRadius = m_InvRadius; //radiusSpeed = -temInvRadius * RadiusSpeed.Rand; maxRadOffset = Random.RandomRange(4f, 7f) * m_size; m_state = State.Grow; trail.height = m_height; trail.width = intervel; trail.vertexColor = PlantCreator.Instance.greenColor; int splitTime = (int)stemNumber.Rand; for (int i = 0; i < splitTime; ++i) { splitList.Add(Random.RandomRange(0.4f, 1.2f)); splitList.Sort(); } int dotTime = (int)seedNumber.Rand; for (int i = 0; i < dotTime; ++i) { dotList.Add(Random.RandomRange(0.2f, 1.2f)); dotList.Sort(); } }
public void Init(PlantCreator.FlowerType type, float size, PlantCreator.FlowerType subType = PlantCreator.FlowerType.None) { m_size = size; m_FlowerType = type; m_FlowerSubType = subType; m_state = State.Show; PlayShowUpAnimation(target, showUpDuration, true, 0.2f); var item = PlantCreator.Instance.GetFlowerItem(m_FlowerType); center.color = item.color; source.clip = initClip; source.Play(); PlayShowPetalAnimation(item.petalNumber, item.budPrefab, item.color, 0); }