Merge pull request #108 from progtime-net/AnimationMakerAdvanced

animations added
This commit is contained in:
SergoDobro 2024-09-07 01:19:53 +03:00 committed by GitHub
commit 69a1437c08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 65 additions and 14 deletions

View file

@ -251,12 +251,21 @@
#begin Textures/Animations/player_top_mining.animation
/copy:Textures/Animations/player_top_mining.animation
#begin Textures/Animations/Player/player_granade.animation
/copy:Textures/Animations/Player/player_granade.animation
#begin Textures/Animations/Player/player_idle.animation
/copy:Textures/Animations/Player/player_idle.animation
#begin Textures/Animations/Player/player_running.animation
/copy:Textures/Animations/Player/player_running.animation
#begin Textures/Animations/Player/player_shoot_1.animation
/copy:Textures/Animations/Player/player_shoot_1.animation
#begin Textures/Animations/Player/player_shoot_2.animation
/copy:Textures/Animations/Player/player_shoot_2.animation
#begin Textures/Animations/running_top.animation
/copy:Textures/Animations/running_top.animation
@ -374,6 +383,18 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running.png
#begin Textures/AnimationTextures/Player/Grenade.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Grenade.png
#begin Textures/AnimationTextures/Player/Idle.png
/importer:TextureImporter
/processor:TextureProcessor
@ -410,6 +431,30 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Run.png
#begin Textures/AnimationTextures/Player/Shot_1.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Shot_1.png
#begin Textures/AnimationTextures/Player/Shot_2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Player/Shot_2.png
#begin Textures/AnimationTextures/unicorn.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1 @@
{"id":"player_die","textureName":"Textures/AnimationTextures/Player/Dead","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":3}],"textureFrameInterval":0,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"player_granade","textureName":"Textures/AnimationTextures/Player/Grenade","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":2}],"textureFrameInterval":0,"framesCount":9,"isCycle":false,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"player_shoot_1","textureName":"Textures/AnimationTextures/Player/Shot_1","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":0,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"player_shoot_2","textureName":"Textures/AnimationTextures/Player/Shot_2","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":0,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -14,7 +14,7 @@ public class AssetManager
{
Animations = [ "player_look_down", "player_run_up", "player_run_down", "player_run_right",
"player_run_left", "player_run_right_up", "player_run_left_up", "player_run_right_down",
"player_run_left_down","player_running","player_idle" ],
"player_run_left_down","player_running","player_idle", "player_shoot_1", "player_shoot_2", "player_granade"],//TODO разрешение указывать папку, из которой все анимации подтянуться, чтобы не мучаться с рутинным добавлением
IdleAnimation = "player_idle"
};
}

View file

@ -56,6 +56,7 @@ public class Player : LivingEntity
}
bool isLookingRight;
public override void Update()
{
#region название current текстуры
@ -73,13 +74,8 @@ public class Player : LivingEntity
switch (AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation))
{
case ScopeState.Top:
if (idName != "player_run_up")
StartAnimation("player_run_up");
break;
case ScopeState.Down:
if (idName != "player_run_down")
StartAnimation("player_run_down");
break;
case ScopeState.Down://i hope in draw animation will be rotated in the right way
case ScopeState.DownRight:
case ScopeState.DownLeft:
case ScopeState.TopRight:
@ -90,8 +86,12 @@ public class Player : LivingEntity
StartAnimation("player_running");
break;
case ScopeState.Idle:
if (idName != "player_idle")
StartAnimation("player_idle");
if (idName != "player_shoot_1" && idName != "player_shoot_2" && idName != "player_granade")//TODO rethink
{
if (idName != "player_idle")
StartAnimation("player_idle");
}
break;
}
if (AppManager.Instance.InputManager.ConvertVector2ToState(InputPlayerRotation) != ScopeState.Idle)
@ -216,12 +216,12 @@ public class Player : LivingEntity
{
InputPlayerRotation = updateInput.InputMovementDirection.GetVector2();
InputWeaponRotation = updateInput.InputAttackDirection.GetVector2();
if (InputPlayerRotation.X != 0f || InputPlayerRotation.Y != 0f)
{
InputPlayerRotation /= (InputPlayerRotation.Length());
}
if (InputPlayerRotation.X != 0f || InputPlayerRotation.Y != 0f)
InputPlayerRotation /= (InputPlayerRotation.Length());
DebugHUD.DebugSet("dir", InputPlayerRotation.ToString());
DebugHUD.DebugSet("dir2", InputWeaponRotation.ToString());
if (InputPlayerRotation.X != 0)
isLookingRight = InputPlayerRotation.X > 0;
}
public void HandleInteract(UpdateInputInteraction updateInputInteraction)
{
@ -252,6 +252,8 @@ public class Player : LivingEntity
reloading = 5;
IsTryingToShoot = true;
StartAnimation("player_shoot_1");
List<Entity> entities = AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation), this).ToList();
entities.AddRange(AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation, 2), this).ToList());
entities.AddRange(AppManager.Instance.server.collisionManager.GetEntities(GetDamageArea(InputWeaponRotation, 3), this).ToList());