private void Update() { //Calculate count int count = (collumns * rows) - (skipFirst + skipLast); //Increment time if (!paused) { time += Time.deltaTime * speed; } if (time > count) { if (destroyOnComplete) { projection.Destroy(); return; } else { time -= count; } } //Calculate current frame int frame = skipFirst + Mathf.FloorToInt(time); //Calculate frame size Vector2 size = new Vector2(1.0f / collumns, 1.0f / rows); //Calculate current row & collumn int row = frame / collumns; int collumn = frame % collumns; //Calculate offset float x = size.x * collumn; float y = size.y * row; if (!invertY) { y = 1 - size.y - y; } //Set tiling projection.Tiling = new Vector2(size.x, size.y); //Set offset projection.Offset = new Vector2(x, y); //Update projection with new properties projection.UpdateProperties(); }
private void SetAlpha(ProjectionRenderer Projection, float Alpha) { switch (Projection.Properties[0].type) { case PropertyType.Float: case PropertyType.Combo: Projection.SetFloat(0, Alpha); break; case PropertyType.Color: Color color = Projection.Properties[0].color; color.a = Alpha; Projection.SetColor(0, color); break; } Projection.UpdateProperties(); }