Files
SlaveMatrix-SDL/SlaveMatrix/SlaveMatrix/BodyPartClasses/Sweat.cs

244 lines
5.7 KiB
C#

using System.Collections.Generic;
using System.Linq;
using _2DGAMELIB;
namespace SlaveMatrix
{
public struct ryps
{
public ShapePart r;
public Vector2D c;
public Vector2D[] ps;
}
public class Sweat
{
private HashSet<string> = new HashSet<string>
{
Sta.ChestType.ToString(),
Sta.TorsoType.ToString(),
Sta.ShoulderType.ToString(),
Sta.WaistType.ToString()
};
private ryps[] ;
private List<Element> = new List<Element>();
private List<double> = new List<double>();
public Motion ;
private Motion ;
private bool = true;
private int i;
private Element ;
private Vector2D tp;
public void Draw(RenderArea Are)
{
if (!.Run && !.Run)
{
return;
}
this.i = 0;
ryps[] array = ;
for (int i = 0; i < array.Length; i++)
{
ryps ryps2 = array[i];
Vector2D[] ps = ryps2.ps;
foreach (Vector2D local in ps)
{
= [this.i];
if (.Intensity != 0.0)
{
tp = ryps2.r.ToGlobal(local);
.Body.CurJoinRoot.PositionBase = tp + (ryps2.r.ToGlobal(ryps2.c) - tp) * [this.i];
.Body.JoinPA();
.();
.Body.Draw(Are);
}
this.i++;
}
}
}
public Sweat(ModeEventDispatcher Med, RenderArea Are, Character Cha, Motions Mots)
{
Element[] es = null;
Element n = null;
bool re = false;
= new Motion(0.0, 1.0)
{
BaseSpeed = 1.0,
OnStart = delegate
{
if ()
{
es = .Where((Element e) => e.Intensity != 0.0).ToArray();
Element[] array5 = es;
for (int num3 = 0; num3 < array5.Length; num3++)
{
array5[num3].Intensity = 0.0;
}
}
},
OnUpdate = delegate(Motion m)
{
if ()
{
Element[] array4 = es;
for (int num2 = 0; num2 < array4.Length; num2++)
{
array4[num2].Intensity = m.Value;
}
}
else if (!re)
{
n.Yv = m.Value;
}
else
{
n.Intensity = m.Value;
}
},
OnReach = delegate(Motion m)
{
if ()
{
Element[] array3 = es;
for (int l = 0; l < array3.Length; l++)
{
array3[l].Intensity = 1.0;
}
m.ResetValue();
= false;
es = .Where((Element e) => e.Intensity != 0.0).ToArray();
n = es[RNG.XS.Next(es.Length)];
}
else
{
re = true;
}
},
OnLoop = delegate(Motion m)
{
if (!)
{
n.Yv = 0.0;
n.Intensity = 0.0;
es = .Where((Element e) => e.Intensity != 0.0).ToArray();
if (es.Length != 0)
{
n = es[RNG.XS.Next(es.Length)];
}
es = .Where((Element e) => e.Intensity == 0.0).ToArray();
if (es.Length != 0)
{
es[RNG.XS.Next(es.Length)].Intensity = 1.0;
}
re = false;
m.ResetValue();
}
},
OnEnd = delegate(Motion m)
{
if (!)
{
n.Yv = 0.0;
n.Intensity = 0.0;
es = .Where((Element e) => e.Intensity != 0.0).ToArray();
n = es[RNG.XS.Next(es.Length)];
es = .Where((Element e) => e.Intensity == 0.0).ToArray();
es[RNG.XS.Next(es.Length)].Intensity = 1.0;
re = false;
m.ResetValue();
.Start();
}
}
};
Mots.Add(.GetHashCode().ToString(), );
= new Motion(0.0, 1.0)
{
BaseSpeed = 1.0,
OnStart = delegate
{
es = .Where((Element e) => e.Intensity != 0.0).ToArray();
},
OnUpdate = delegate(Motion m)
{
Element[] array2 = es;
for (int k = 0; k < array2.Length; k++)
{
array2[k].Intensity = m.Value.Inverse();
}
},
OnReach = delegate(Motion m)
{
m.End();
m.ResetValue();
Element[] array = es;
for (int j = 0; j < array.Length; j++)
{
array[j].Intensity = 1.0;
}
= true;
},
OnLoop = delegate
{
},
OnEnd = delegate
{
}
};
Mots.Add(.GetHashCode().ToString(), );
List<ryps> list = new List<ryps>();
int num = 0;
D e2 = new D();
ryps ryps;
foreach (Element item in Cha.Body.Elements.Where((Element e) => .Contains(e.GetType().ToString())))
{
ryps = default(ryps);
ryps.r = item.Body.CurJoinRoot;
ryps.c = ryps.r.OP.GetCenter();
ryps.ps = (from p in ryps.r.OP.EnumPoints()
where ryps.c.Y > p.Y
select p).ToArray();
list.Add(ryps);
Vector2D[] ps = ryps.ps;
for (int i = 0; i < ps.Length; i++)
{
_ = ref ps[i];
= new (Are.DisplayUnitScale, .N0, Cha.ColorSet, Med, e2);
.SetHitFalse();
.Intensity = ((RNG.XS.NextDouble() < 0.2) ? 1.0 : 0.0);
.Add(num switch
{
1 => 0.5,
0 => 0.7,
_ => 0.3,
});
.Add();
num = ((num != 2) ? (num + 1) : 0);
}
}
= list.ToArray();
}
public void Dispose()
{
foreach (Element item in )
{
item.Dispose();
}
}
}
}