public void emission(VoxelMesh mesh, int count = 80, GDGeek.Tween.Method method = GDGeek.Tween.Method.easeOutQuad) { for (int i = 0; i < count; ++i) { GameObject obj = _pool.create(); Voxel voxel = obj.GetComponent <Voxel>(); obj.SetActive(true); VoxelProperty begin = new VoxelProperty(); begin.color = RandomColor(mesh); begin.position = RandomPosition(mesh); begin.scale = Vector3.one * 2.0f; VoxelProperty end = new VoxelProperty(); end.color = begin.color; end.position = begin.position + Random.insideUnitSphere * 100.0f; end.scale = Vector3.one * 4.0f; voxel.property = begin; Tween tween = TweenVoxel.Begin(obj, Random.Range(0.5f, 0.9f), end); tween.method = method; tween.onFinished = delegate { obj.SetActive(false); }; } }
public VoxelProperty mul(float f) { VoxelProperty ret = new VoxelProperty(); ret.position = this.position * f; ret.color = this.color * f; ret.scale = this.scale * f; return ret; }
public VoxelProperty add(VoxelProperty prop) { VoxelProperty ret = new VoxelProperty(); ret.position = this.position + prop.position; ret.color = this.color + prop.color; ret.scale = this.scale + prop.scale; return ret; }
public VoxelProperty add(VoxelProperty prop) { VoxelProperty ret = new VoxelProperty(); ret.position = this.position + prop.position; ret.color = this.color + prop.color; ret.scale = this.scale + prop.scale; return(ret); }
public VoxelProperty mul(float f) { VoxelProperty ret = new VoxelProperty(); ret.position = this.position * f; ret.color = this.color * f; ret.scale = this.scale * f; return(ret); }
/// <summary> /// Start the tweening operation. /// </summary> public static TweenVoxel2 Begin(GameObject go, float duration, VoxelProperty prop) { TweenVoxel2 comp = Tween.Begin<TweenVoxel2>(go, duration); comp.from = comp.property; comp.to = prop; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return comp; }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenVoxel Begin(GameObject go, float duration, VoxelProperty prop) { TweenVoxel tween = Tween.Begin <TweenVoxel>(go, duration); tween.from = tween.property; tween.to = prop; if (duration <= 0f) { tween.Sample(1f, true); tween.enabled = false; } return(tween); }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenVoxel2 Begin(GameObject go, float duration, VoxelProperty prop) { TweenVoxel2 comp = Tween.Begin <TweenVoxel2>(go, duration); comp.from = comp.property; comp.to = prop; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
public void emission () { VoxelProperty prop = new VoxelProperty (); this._voxel.color = beginColor_; this.transform.localScale = this.beginScale_; prop.color = endColor_; prop.position = this.transform.position + director_ * speed_ * time_; prop.scale = this.endScale_; Tween tween = TweenVoxel2.Begin(this.gameObject, time_, prop); tween.method = this.method_; tween.onFinished = delegate { this.gameObject.SetActive(false); }; }
public void emission() { VoxelProperty prop = new VoxelProperty(); this._voxel.color = beginColor_; this.transform.localScale = this.beginScale_; prop.color = endColor_; prop.position = this.transform.position + director_ * speed_ * time_; prop.scale = this.endScale_; Tween tween = TweenVoxel.Begin(this.gameObject, time_, prop); tween.method = this.method_; tween.onFinished = delegate { this.gameObject.SetActive(false); }; }
override protected void OnUpdate(float factor, bool isFinished) { property = from.mul(1f - factor).add(to.mul(factor)); }
override protected void OnUpdate (float factor, bool isFinished){ property = from.mul(1f - factor).add(to.mul(factor)); }