Skip to content

Commit bb94027

Browse files
committed
Update code styles
1 parent 3db3efa commit bb94027

20 files changed

+154
-190
lines changed

Runtime/AnimatedSprite.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public sealed class AnimatedSprite : MonoBehaviour
5151

5252
private void Awake()
5353
{
54-
this.spriteRenderer = GetComponent<SpriteRenderer>();
54+
spriteRenderer = GetComponent<SpriteRenderer>();
5555
}
5656

5757
private void Start()
@@ -64,31 +64,31 @@ private void Start()
6464
/// </summary>
6565
public void Restart()
6666
{
67-
this.frame = 0;
67+
frame = 0;
6868
SetSprite();
6969
}
7070

7171
private void Update()
7272
{
73-
if (Time.time >= this.nextFrameTime && this.frameRate != 0f) {
73+
if (Time.time >= nextFrameTime && frameRate != 0f) {
7474
NextFrame();
7575
}
7676
}
7777

7878
private void NextFrame()
7979
{
80-
if (this.reversed) {
81-
this.frame--;
80+
if (reversed) {
81+
frame--;
8282
} else {
83-
this.frame++;
83+
frame++;
8484
}
8585

86-
if (this.frame < 0 || this.frame >= this.sprites.Length)
86+
if (frame < 0 || frame >= sprites.Length)
8787
{
88-
if (this.loop) {
89-
this.frame = this.reversed ? this.sprites.Length - 1 : 0;
88+
if (loop) {
89+
frame = reversed ? sprites.Length - 1 : 0;
9090
} else {
91-
this.frame = Mathf.Clamp(this.frame, 0, this.sprites.Length - 1);
91+
frame = Mathf.Clamp(frame, 0, sprites.Length - 1);
9292
}
9393
}
9494

@@ -98,17 +98,17 @@ private void NextFrame()
9898

9999
private void SetSprite()
100100
{
101-
if (this.frame >= 0 && this.frame < this.sprites.Length) {
102-
this.spriteRenderer.sprite = this.sprites[this.frame];
101+
if (frame >= 0 && frame < sprites.Length) {
102+
spriteRenderer.sprite = sprites[frame];
103103
}
104104
}
105105

106106
private void SetNextFrameTime()
107107
{
108-
if (this.frameRate != 0f)
108+
if (frameRate != 0f)
109109
{
110-
float timing = 1f / this.frameRate;
111-
this.nextFrameTime = Time.time + timing;
110+
float timing = 1f / frameRate;
111+
nextFrameTime = Time.time + timing;
112112
}
113113
}
114114

Runtime/Blink.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,24 @@ public sealed class Blink : MonoBehaviour
7878

7979
private void Awake()
8080
{
81-
this.renderer = GetComponent<Renderer>();
81+
renderer = GetComponent<Renderer>();
8282
}
8383

8484
private void OnEnable()
8585
{
86-
this.blinking = false;
87-
this.cooldown = false;
86+
blinking = false;
87+
cooldown = false;
8888
}
8989

9090
private void Update()
9191
{
92-
if (Time.time >= this.nextUpdateTime)
92+
if (Time.time >= nextUpdateTime)
9393
{
94-
if (Random.value < this.blinkChance) {
94+
if (Random.value < blinkChance) {
9595
BlinkOnce();
9696
}
9797

98-
this.nextUpdateTime = Time.time + this.updateInterval;
98+
nextUpdateTime = Time.time + updateInterval;
9999
}
100100
}
101101

@@ -104,50 +104,50 @@ private void Update()
104104
/// </summary>
105105
public void BlinkOnce()
106106
{
107-
if (this.blinking || this.cooldown) {
107+
if (blinking || cooldown) {
108108
return;
109109
}
110110

111-
this.blinking = true;
111+
blinking = true;
112112

113-
AssignMaterial(this.blinkingMaterial);
114-
Invoke(nameof(FinishBlink), this.blinkDuration.Random());
113+
AssignMaterial(blinkingMaterial);
114+
Invoke(nameof(FinishBlink), blinkDuration.Random());
115115
}
116116

117117
private void FinishBlink()
118118
{
119-
this.blinking = false;
119+
blinking = false;
120120

121-
AssignMaterial(this.notBlinkingMaterial);
121+
AssignMaterial(notBlinkingMaterial);
122122
Cooldown();
123123
}
124124

125125
private void AssignMaterial(Material material)
126126
{
127-
this.renderer.material = material;
127+
renderer.material = material;
128128

129-
if (this.sharedRenderers != null)
129+
if (sharedRenderers != null)
130130
{
131-
for (int i = 0; i < this.sharedRenderers.Length; i++) {
132-
this.sharedRenderers[i].material = material;
131+
for (int i = 0; i < sharedRenderers.Length; i++) {
132+
sharedRenderers[i].material = material;
133133
}
134134
}
135135
}
136136

137137
private void Cooldown()
138138
{
139-
float duration = this.blinkCooldown.Random();
139+
float duration = blinkCooldown.Random();
140140

141141
if (duration > 0f)
142142
{
143-
this.cooldown = true;
144-
Invoke(nameof(CooldownComplete), this.blinkCooldown.Random());
143+
cooldown = true;
144+
Invoke(nameof(CooldownComplete), blinkCooldown.Random());
145145
}
146146
}
147147

148148
private void CooldownComplete()
149149
{
150-
this.cooldown = false;
150+
cooldown = false;
151151
}
152152

153153
}

Runtime/DataStructures/SmoothDampFloat.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ public class SmoothDampFloat : SmoothDamp<float>
1616
/// <returns>The new current value.</returns>
1717
public override float Update(float target)
1818
{
19-
this.value = Mathf.SmoothDamp(this.value, target,
20-
ref _velocity,
21-
this.smoothTime,
22-
this.maxSpeed);
23-
24-
return this.value;
19+
value = Mathf.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed);
20+
return value;
2521
}
2622

2723
/// <summary>
@@ -33,13 +29,8 @@ public override float Update(float target)
3329
/// <returns>The new current value.</returns>
3430
public override float Update(float target, float deltaTime)
3531
{
36-
this.value = Mathf.SmoothDamp(this.value, target,
37-
ref _velocity,
38-
this.smoothTime,
39-
this.maxSpeed,
40-
deltaTime);
41-
42-
return this.value;
32+
value = Mathf.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed, deltaTime);
33+
return value;
4334
}
4435

4536
}

Runtime/DataStructures/SmoothDampVector2.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ public class SmoothDampVector2 : SmoothDamp<Vector2>
1616
/// <returns>The new current value.</returns>
1717
public override Vector2 Update(Vector2 target)
1818
{
19-
this.value = Vector2.SmoothDamp(this.value, target,
20-
ref _velocity,
21-
this.smoothTime,
22-
this.maxSpeed);
23-
24-
return this.value;
19+
value = Vector2.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed);
20+
return value;
2521
}
2622

2723
/// <summary>
@@ -33,13 +29,8 @@ public override Vector2 Update(Vector2 target)
3329
/// <returns>The new current value.</returns>
3430
public override Vector2 Update(Vector2 target, float deltaTime)
3531
{
36-
this.value = Vector2.SmoothDamp(this.value, target,
37-
ref _velocity,
38-
this.smoothTime,
39-
this.maxSpeed,
40-
deltaTime);
41-
42-
return this.value;
32+
value = Vector2.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed, deltaTime);
33+
return value;
4334
}
4435

4536
}

Runtime/DataStructures/SmoothDampVector3.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ public class SmoothDampVector3 : SmoothDamp<Vector3>
1616
/// <returns>The new current value.</returns>
1717
public override Vector3 Update(Vector3 target)
1818
{
19-
this.value = Vector3.SmoothDamp(this.value, target,
20-
ref _velocity,
21-
this.smoothTime,
22-
this.maxSpeed);
23-
24-
return this.value;
19+
value = Vector3.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed);
20+
return value;
2521
}
2622

2723
/// <summary>
@@ -33,13 +29,8 @@ public override Vector3 Update(Vector3 target)
3329
/// <returns>The new current value.</returns>
3430
public override Vector3 Update(Vector3 target, float deltaTime)
3531
{
36-
this.value = Vector3.SmoothDamp(this.value, target,
37-
ref _velocity,
38-
this.smoothTime,
39-
this.maxSpeed,
40-
deltaTime);
41-
42-
return this.value;
32+
value = Vector3.SmoothDamp(value, target, ref _velocity, smoothTime, maxSpeed, deltaTime);
33+
return value;
4334
}
4435

4536
}

Runtime/DataStructures/Timing.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Timing(float start, float end)
3737
/// <returns>A random time within the start and end time.</returns>
3838
public float Random()
3939
{
40-
return UnityEngine.Random.Range(this.start, this.end);
40+
return UnityEngine.Random.Range(start, end);
4141
}
4242

4343
/// <summary>
@@ -47,7 +47,7 @@ public float Random()
4747
/// <returns>True if the time is within the start and end time.</returns>
4848
public bool Includes(float time)
4949
{
50-
return time >= this.start && time <= this.end;
50+
return time >= start && time <= end;
5151
}
5252

5353
}

Runtime/DataStructures/Timing01.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Timing01(float start, float end)
5353
/// <returns>A random time within the start and end time.</returns>
5454
public float Random()
5555
{
56-
return UnityEngine.Random.Range(this.start, this.end);
56+
return UnityEngine.Random.Range(start, end);
5757
}
5858

5959
/// <summary>
@@ -63,7 +63,7 @@ public float Random()
6363
/// <returns>True if the time is within the start and end time.</returns>
6464
public bool Includes(float time)
6565
{
66-
return time >= this.start && time <= this.end;
66+
return time >= start && time <= end;
6767
}
6868

6969
}

Runtime/DataStructures/TimingRange.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public TimingRange(float min, float max)
3737
/// <returns>A random time within the min and max time.</returns>
3838
public float Random()
3939
{
40-
return UnityEngine.Random.Range(this.min, this.max);
40+
return UnityEngine.Random.Range(min, max);
4141
}
4242

4343
/// <summary>
@@ -47,7 +47,7 @@ public float Random()
4747
/// <returns>True if the time is within the min and max time.</returns>
4848
public bool Includes(float time)
4949
{
50-
return time >= this.min && time <= this.max;
50+
return time >= min && time <= max;
5151
}
5252

5353
}

Runtime/DataStructures/TimingRange01.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public TimingRange01(float min, float max)
5252
/// </summary>
5353
public float Random()
5454
{
55-
return UnityEngine.Random.Range(this.min, this.max);
55+
return UnityEngine.Random.Range(min, max);
5656
}
5757

5858
/// <summary>
@@ -62,7 +62,7 @@ public float Random()
6262
/// <returns>True if the time is within the min and max time.</returns>
6363
public bool Includes(float time)
6464
{
65-
return time >= this.min && time <= this.max;
65+
return time >= min && time <= max;
6666
}
6767

6868
}

Runtime/DataStructures/Vector2AnimationCurve.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,22 @@ public sealed class Vector2AnimationCurve : IAnimationCurve<Vector2>
2424
/// <inheritdoc/>
2525
public Vector2 Evaluate(float time)
2626
{
27-
return new Vector2(
28-
this.x.Evaluate(time),
29-
this.y.Evaluate(time));
27+
return new Vector2(x.Evaluate(time), y.Evaluate(time));
3028
}
3129

3230
/// <inheritdoc/>
3331
/// <param name="value">The value for the key (vertical axis in the curve graph).</param>
3432
public void AddKey(float time, Vector2 value)
3533
{
36-
this.x.AddKey(time, value.x);
37-
this.y.AddKey(time, value.y);
34+
x.AddKey(time, value.x);
35+
y.AddKey(time, value.y);
3836
}
3937

4038
/// <inheritdoc/>
4139
public void RemoveKey(int index)
4240
{
43-
this.x.RemoveKey(index);
44-
this.y.RemoveKey(index);
41+
x.RemoveKey(index);
42+
y.RemoveKey(index);
4543
}
4644

4745
}

0 commit comments

Comments
 (0)