A small game Component that represents a cloud. It stores a 2D velocity and a deceleration value, moves the entity by adding velocity each frame to WorldPosition, and damps velocity over time.
using Sandbox;
using System;
public sealed class Cloud : Component
{
public Vector2 Velocity { get; set; }
public float Deceleration { get; set; }
protected override void OnUpdate()
{
WorldPosition += (Vector3)(Velocity * Time.Delta);
Velocity *= Math.Max( 1f - Time.Delta * Deceleration, 0f );
// todo: affected by wind
}
}