/* Function: public Sprite(Texture2D texture, Rectangle sourceRectangle, Vector2 position, Color color, Vector2 origin, float rotation, float scale, float depth); * Purpose: Constructor ****************************************************************/ public Sprite(Texture2D texture, Rectangle sourceRectangle, Vector2 position, Color color, Vector2 origin, float rotation, float scale, float depth) { this.m_Texture = texture; this.m_SourceRectangle = sourceRectangle; this.m_Position = position; this.m_Color = new fColor(color); this.m_Origin = origin; this.m_Rotation = rotation; this.m_Scale = scale; this.m_Depth = depth; }
public void CreateParticle(Texture2D texture, Rectangle sourceRect, ParticleInfo pInfo, EmitterType type) { if (sourceRect != Rectangle.Empty) this.Initialize(texture, sourceRect); else this.Initialize(texture); m_Type = type; m_CurrentLife = pInfo.m_Lifespan; m_Lifespan = pInfo.m_Lifespan; m_Position = pInfo.m_Pos; m_StartPos = pInfo.m_StartPos; m_Velocity = pInfo.m_Velocity; m_EmitterRadius = pInfo.m_EmitterRadius; m_EmitterRadiusDelta = pInfo.m_EmitterRadiusDelta; m_EmitterRotation = pInfo.m_EmitterRotation; m_EmitterRotationDelta = pInfo.m_EmitterRotationDelta; m_RadialAcceleration = pInfo.m_RadialAcceleration; m_TangentialAcceleration = pInfo.m_TangentialAcceleration; m_Scale = pInfo.m_Scale; m_ScaleDelta = pInfo.m_ScaleDelta; m_Color = pInfo.m_StartColor; m_StartColor = pInfo.m_StartColor; m_EndColor = pInfo.m_EndColor; m_ColorDelta = pInfo.m_ColorDelta; m_Rotation = pInfo.m_Rotation; m_RotationDelta = pInfo.m_RotationDelta; m_Depth = pInfo.m_Depth; m_DepthDelta = pInfo.m_DepthDelta; m_Speed = pInfo.m_Speed; }
/* Function: public void Initialize(Texture2D texture, int sourceX, int sourceY) * Purpose: To initialize the sprite to default values ****************************************************************/ public void Initialize(Texture2D texture, Rectangle sourceRect) { this.m_Texture = texture; this.m_Position = new Vector2(); this.m_Origin = new Vector2(texture.Width / 2, texture.Height / 2); this.m_SourceRectangle = sourceRect; this.m_Rotation = 0f; this.m_Scale = 1f; this.m_Depth = 0f; this.m_Color = new fColor(Color.White); }
protected void InitializeColorConfig() { m_StartColor = new fColor(255f, 0f, 0f, 153f); m_StartColorVariance = new fColor(0f, 0f, 0f, 0f); m_EndColor = new fColor(255f, 127f, 0f, 0f); m_EndColorVariance = new fColor(0f, 0f, 0f, 0f); }