Use pattern matching
This commit is contained in:
committed by
atlimit8
parent
aed2b8afae
commit
2677e9c013
@@ -223,8 +223,7 @@ namespace OpenRA.Graphics
|
||||
ShadowAmbient, ShadowDiffuse, shadowPalette.TextureMidIndex, normals.TextureMidIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
));
|
||||
}));
|
||||
|
||||
var screenLightVector = Util.MatrixVectorMultiply(invShadowTransform, ZVector);
|
||||
screenLightVector = Util.MatrixVectorMultiply(cameraTransform, screenLightVector);
|
||||
|
||||
@@ -177,8 +177,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
foreach (var e in World.Effects)
|
||||
{
|
||||
var ea = e as IEffectAboveShroud;
|
||||
if (ea == null)
|
||||
if (!(e is IEffectAboveShroud ea))
|
||||
continue;
|
||||
|
||||
foreach (var renderable in ea.RenderAboveShroud(this))
|
||||
@@ -219,8 +218,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
foreach (var e in World.Effects)
|
||||
{
|
||||
var ea = e as IEffectAnnotation;
|
||||
if (ea == null)
|
||||
if (!(e is IEffectAnnotation ea))
|
||||
continue;
|
||||
|
||||
foreach (var renderAnnotation in ea.RenderAnnotation(this))
|
||||
|
||||
@@ -87,8 +87,7 @@ namespace OpenRA
|
||||
var ret = new MiniYaml(Type);
|
||||
foreach (var o in initDict.Value)
|
||||
{
|
||||
var init = o as ActorInit;
|
||||
if (init == null || o is ISuppressInitExport)
|
||||
if (!(o is ActorInit init) || o is ISuppressInitExport)
|
||||
continue;
|
||||
|
||||
if (initFilter != null && !initFilter(init))
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Primitives
|
||||
public static bool operator !=(BitSet<T> me, BitSet<T> other) { return !(me == other); }
|
||||
|
||||
public bool Equals(BitSet<T> other) { return other == this; }
|
||||
public override bool Equals(object obj) { return obj is BitSet<T> && Equals((BitSet<T>)obj); }
|
||||
public override bool Equals(object obj) { return obj is BitSet<T> bitSet && Equals(bitSet); }
|
||||
public override int GetHashCode() { return bits.GetHashCode(); }
|
||||
|
||||
public bool IsEmpty => bits == 0;
|
||||
|
||||
@@ -86,8 +86,7 @@ namespace OpenRA.Scripting
|
||||
{
|
||||
foreach (var arg in clrArgs)
|
||||
{
|
||||
var table = arg as LuaValue[];
|
||||
if (table == null)
|
||||
if (!(arg is LuaValue[] table))
|
||||
continue;
|
||||
|
||||
foreach (var value in table)
|
||||
|
||||
Reference in New Issue
Block a user