Beispiel #1
0
    private void Update()
    {
        var world = this.Owner.Get <TransformComponent>().Matrix;

        for (int i = 0; i < InstanceCount; i++)
        {
            var instance = Instances[i];
            instance.Time += instance.CountSpeed;

            if (1 < instance.Time)
            {
                instance.Time       = 0;
                instance.CountSpeed = uniform(0.05f, 0.1f);

                float r  = normal(15, 5) + 15;
                float t  = uniform(0, PI2);
                float z  = normal(70, 20);
                float dx = normal(0.5f, 0.2f);
                float dz = normal(20, 5);

                Matrix4x3 adjustment = new Matrix4x3().Identity();
                adjustment.RotateZ(t);
                adjustment.Translate(0, -r, z);
                adjustment.Scale(dx, 0, dz);
                instance.Matrix = adjustment * world;
            }
        }
    }