DangerousD/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
2023-08-17 15:27:10 +03:00

60 lines
1.8 KiB
C#

using DangerousD.GameCore.Graphics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DangerousD.GameCore.GameObjects.PlayerDeath;
namespace DangerousD.GameCore.GameObjects.LivingEntities
{
public class Player : LivingEntity
{
bool isAlive = true;
bool isRight;
string stayAnimation;
public Player(Vector2 position) : base(position)
{
Width = 24;
Height = 32;
AppManager.Instance.InputManager.MovEventJump += Jump;
}
public bool IsAlive { get { return isAlive; } }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
"playerJumpRight" , "playerJumpLeft"}, "playerStayLeft");
public void Kill()
{
}
public void Death(string monsterName)
{
if(monsterName == "Zombie")
{
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
{
if (a == "DeathFrom" + monsterName)
{
AppManager.Instance.ChangeGameState(GameState.GameOver);
}
};
}
isAlive = false;
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
public void Jump()
{
velocity.Y = -300;
//сюда анимацию и доделать
}
}
}