source: OniSplit/Particles/Attractor.cs@ 1114

Last change on this file since 1114 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 2.8 KB
Line 
1namespace Oni.Particles
2{
3 internal class Attractor
4 {
5 #region Private data
6 private AttractorTarget target;
7 private AttractorSelector selector;
8 private string className;
9 private Value maxDistance;
10 private Value maxAngle;
11 private Value angleSelectMin;
12 private Value angleSelectMax;
13 private Value angleSelectWeight;
14 #endregion
15
16 public Attractor()
17 {
18 target = AttractorTarget.None;
19 selector = AttractorSelector.Distance;
20 maxDistance = new Value(150.0f);
21 maxAngle = new Value(30.0f);
22 angleSelectMin = new Value(3.0f);
23 angleSelectMax = new Value(3.0f);
24 angleSelectWeight = new Value(3.0f);
25 }
26
27 public Attractor(BinaryReader reader)
28 {
29 target = (AttractorTarget)reader.ReadInt32();
30 selector = (AttractorSelector)reader.ReadInt32();
31 reader.Skip(4);
32 className = reader.ReadString(64);
33 maxDistance = Value.Read(reader);
34 maxAngle = Value.Read(reader);
35 angleSelectMin = Value.Read(reader);
36 angleSelectMax = Value.Read(reader);
37 angleSelectWeight = Value.Read(reader);
38 }
39
40 public void Write(BinaryWriter writer)
41 {
42 writer.Write((int)target);
43 writer.Write((int)selector);
44 writer.Skip(4);
45 writer.Write(className, 64);
46 maxDistance.Write(writer);
47 maxAngle.Write(writer);
48 angleSelectMin.Write(writer);
49 angleSelectMax.Write(writer);
50 angleSelectWeight.Write(writer);
51 }
52
53 public AttractorTarget Target
54 {
55 get { return target; }
56 set { target = value; }
57 }
58
59 public AttractorSelector Selector
60 {
61 get { return selector; }
62 set { selector = value; }
63 }
64
65 public string ClassName
66 {
67 get { return className; }
68 set { className = value; }
69 }
70
71 public Value MaxDistance
72 {
73 get { return maxDistance; }
74 set { maxDistance = value; }
75 }
76
77 public Value MaxAngle
78 {
79 get { return maxAngle; }
80 set { maxAngle = value; }
81 }
82
83 public Value AngleSelectMin
84 {
85 get { return angleSelectMin; }
86 set { angleSelectMin = value; }
87 }
88
89 public Value AngleSelectMax
90 {
91 get { return angleSelectMax; }
92 set { angleSelectMax = value; }
93 }
94
95 public Value AngleSelectWeight
96 {
97 get { return angleSelectWeight; }
98 set { angleSelectWeight = value; }
99 }
100 }
101}
Note: See TracBrowser for help on using the repository browser.