DangerousD/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
2023-08-17 11:40:52 +03:00

45 lines
1.4 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;
public Player(Vector2 position) : base(position)
{
Width = 32;
Height = 64;
}
public bool IsAlive { get { return isAlive; } }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack", "DeathFromZombie" }, "ZombieMoveLeft");//TODO: Change to player
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;
}
}
}