Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client * Remove #nullable enable * Merge fixes * Remove Debug.Assert * Merge fixes * Fix build * Fix build
This commit is contained in:
@@ -11,10 +11,10 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee
|
||||
{
|
||||
public override string Name => "MeleeWeaponArcAnimation";
|
||||
|
||||
private MeleeWeaponAnimationPrototype _meleeWeaponAnimation;
|
||||
private MeleeWeaponAnimationPrototype? _meleeWeaponAnimation;
|
||||
|
||||
private float _timer;
|
||||
private SpriteComponent _sprite;
|
||||
private SpriteComponent? _sprite;
|
||||
private Angle _baseAngle;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee
|
||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true)
|
||||
{
|
||||
_meleeWeaponAnimation = prototype;
|
||||
_sprite.AddLayer(new RSI.StateId(prototype.State));
|
||||
_sprite?.AddLayer(new RSI.StateId(prototype.State));
|
||||
_baseAngle = baseAngle;
|
||||
if(followAttacker)
|
||||
Owner.Transform.AttachParent(attacker);
|
||||
@@ -44,7 +44,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee
|
||||
|
||||
var (r, g, b, a) =
|
||||
Vector4.Clamp(_meleeWeaponAnimation.Color + _meleeWeaponAnimation.ColorDelta * _timer, Vector4.Zero, Vector4.One);
|
||||
_sprite.Color = new Color(r, g, b, a);
|
||||
|
||||
if (_sprite != null)
|
||||
{
|
||||
_sprite.Color = new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
switch (_meleeWeaponAnimation.ArcType)
|
||||
{
|
||||
@@ -56,7 +60,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee
|
||||
|
||||
case WeaponArcType.Poke:
|
||||
Owner.Transform.WorldRotation = _baseAngle;
|
||||
_sprite.Offset -= (0, _meleeWeaponAnimation.Speed * frameTime);
|
||||
|
||||
if (_sprite != null)
|
||||
{
|
||||
_sprite.Offset -= (0, _meleeWeaponAnimation.Speed * frameTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user