Анимации выбрасывания предметов и вставки в хранилище (#3663)
Co-authored-by: Kara <mirrorcult@pm.me>
This commit is contained in:
parent
40cb9b4e95
commit
5507f118b1
3 changed files with 63 additions and 2 deletions
|
|
@ -68,7 +68,8 @@ public sealed class EntityPickupAnimationSystem : EntitySystem
|
|||
|
||||
_animations.Play(new Entity<AnimationPlayerComponent>(animatableClone, animations), new Animation
|
||||
{
|
||||
Length = TimeSpan.FromMilliseconds(125),
|
||||
// Sunrise-Edit - портирование анимаций с ES
|
||||
Length = TimeSpan.FromMilliseconds(175),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackComponentProperty
|
||||
|
|
@ -79,10 +80,33 @@ public sealed class EntityPickupAnimationSystem : EntitySystem
|
|||
KeyFrames =
|
||||
{
|
||||
new KeyFrame(initial.Position, 0),
|
||||
new KeyFrame(final, 0.125f)
|
||||
new KeyFrame(final, 0.175f, Easings.OutQuad)
|
||||
}
|
||||
},
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(SpriteComponent),
|
||||
Property = nameof(SpriteComponent.Scale),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new KeyFrame(sprite.Scale, 0),
|
||||
new KeyFrame(new Vector2(0.5f, 0.5f), 0.175f, Easings.OutQuad)
|
||||
}
|
||||
},
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(SpriteComponent),
|
||||
Property = nameof(SpriteComponent.Color),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new KeyFrame(sprite.Color, 0),
|
||||
new KeyFrame(sprite.Color.WithAlpha(0f), 0.175f, Easings.OutQuad)
|
||||
}
|
||||
},
|
||||
}
|
||||
// Sunrise-Edit
|
||||
}, "fancy_pickup_anim");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,6 +165,20 @@ public abstract partial class SharedHandsSystem
|
|||
var origin = new MapCoordinates(itemPos, itemXform.MapID);
|
||||
var target = TransformSystem.ToMapCoordinates(targetDropLocation.Value);
|
||||
TransformSystem.SetWorldPositionRotation(entity.Value, GetFinalDropCoordinates(ent, origin, target, entity.Value), itemRot);
|
||||
|
||||
// Sunrise-Edit - анимации выкидывания предметов на землю
|
||||
// Это почти полная копипаста анимации из TryPickup()
|
||||
var currentCoords = TransformSystem.GetMoverCoordinates(entity.Value);
|
||||
var currentMapCoords = TransformSystem.GetMapCoordinates(entity.Value);
|
||||
|
||||
if (itemXform.MapID == userXform.MapID
|
||||
&& (currentMapCoords.Position - TransformSystem.GetMapCoordinates(ent, userXform).Position).Length() <= MaxAnimationRange
|
||||
&& MetaData(entity.Value).VisibilityMask == MetaData(ent).VisibilityMask) // Don't animate aghost pickups.
|
||||
{
|
||||
_storage.PlayPickupAnimation(entity.Value, userXform.Coordinates, currentCoords, itemXform.LocalRotation, ent);
|
||||
}
|
||||
// Sunrise-Edit
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1209,6 +1209,17 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||
if (canPlaySound)
|
||||
Audio.PlayPredicted(storageComp.StorageInsertSound, uid, user, _audioParams);
|
||||
|
||||
// Sunrise-Edit - анимация забирания предмета из хранилища
|
||||
if (user != null)
|
||||
{
|
||||
PlayPickupAnimation(insertEnt,
|
||||
Transform(user.Value).Coordinates,
|
||||
Transform(uid).Coordinates,
|
||||
Transform(insertEnt).LocalRotation,
|
||||
user);
|
||||
}
|
||||
// Sunrise-Edit
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1236,6 +1247,18 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||
return false;
|
||||
}
|
||||
|
||||
// Sunrise-Edit - анимация забирания предмета из хранилища
|
||||
// Ссаное говно, почему тут две точки успешного выхода
|
||||
if (user != null)
|
||||
{
|
||||
PlayPickupAnimation(insertEnt,
|
||||
Transform(user.Value).Coordinates,
|
||||
Transform(uid).Coordinates,
|
||||
Transform(insertEnt).LocalRotation,
|
||||
user);
|
||||
}
|
||||
// Sunrise-Edit
|
||||
|
||||
if (canPlaySound)
|
||||
Audio.PlayPredicted(storageComp.StorageInsertSound, uid, user, _audioParams);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue