Esempio n. 1
0
 public override void Apply(Entity entity, DrawData? drawData)
 {
     Player player = entity as Player;
     if (player == null || player.team == 0)
         dustShaderData[0].Apply(player, drawData);
     else
     {
         this.UseColor(Main.teamColor[player.team]);
         base.Apply(player, drawData);
     }
 }
        public override void Apply(Entity entity, DrawData? drawData)
        {
            if (entity == null)
                _shader.Parameters["uLightSource"].SetValue(Vector3.Zero);
            else
            {
                float num1 = 0.0f;
                if (drawData.HasValue)
                    num1 = drawData.Value.rotation;

                Vector2 vector2_1 = entity.position;
                float x1 = (float)entity.width;
                float y1 = (float)entity.height;
                Vector2 vector2_2 = vector2_1 + new Vector2(x1, y1) * 0.1f;
                float x2 = x1 * 0.8f;
                float y2 = y1 * 0.8f;
                Vector3 subLight1 = Lighting.GetSubLight(vector2_2 + new Vector2(x2 * 0.5f, 0.0f));
                Vector3 subLight2 = Lighting.GetSubLight(vector2_2 + new Vector2(0.0f, y2 * 0.5f));
                Vector3 subLight3 = Lighting.GetSubLight(vector2_2 + new Vector2(x2, y2 * 0.5f));
                Vector3 subLight4 = Lighting.GetSubLight(vector2_2 + new Vector2(x2 * 0.5f, y2));
                float num2 = subLight1.X + subLight1.Y + subLight1.Z;
                float num3 = subLight2.X + subLight2.Y + subLight2.Z;
                float num4 = subLight3.X + subLight3.Y + subLight3.Z;
                float num5 = subLight4.X + subLight4.Y + subLight4.Z;
                Vector2 spinningpoint = new Vector2(num4 - num3, num5 - num2);
                if ((double)spinningpoint.Length() > 1.0)
                {
                    float num6 = 1f;
                    spinningpoint /= num6;
                }

                if (entity.direction == -1)
                    spinningpoint.X *= -1f;

                spinningpoint = Utils.RotatedBy(spinningpoint, -(double)num1, new Vector2());
                Vector3 vector3 = new Vector3(spinningpoint, (float)(1.0 - ((double)spinningpoint.X * (double)spinningpoint.X + (double)spinningpoint.Y * (double)spinningpoint.Y)));
                vector3.X *= 2f;
                vector3.Y -= 0.15f;
                vector3.Y *= 2f;
                vector3.Normalize();
                vector3.Z *= 0.6f;
                _shader.Parameters["uLightSource"].SetValue(vector3);
            }
            base.Apply(entity, drawData);
        }
Esempio n. 3
0
 public override ArmorShaderData GetSecondaryShader(Entity entity)
 {
     Player player = entity as Player;
     return dustShaderData[player.team];
 }
Esempio n. 4
0
 public virtual MiscShaderData GetSecondaryShader(Entity entity)
 {
     return this;
 }