Some Изменения
This commit is contained in:
parent
ba4466d966
commit
37bb9fbb66
2 changed files with 26 additions and 9 deletions
|
@ -6,18 +6,21 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DangerousD.GameCore.GameObjects.PlayerDeath;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||
{
|
||||
public class Player : LivingEntity
|
||||
{
|
||||
bool isAlive = true;
|
||||
public int health;
|
||||
public Player(Vector2 position) : base(position)
|
||||
{
|
||||
Width = 32;
|
||||
Height = 64;
|
||||
AppManager.Instance.InputManager.MovEventJump += AnimationJump;
|
||||
|
||||
AppManager.Instance.InputManager.MovEventJump += Jump;
|
||||
AppManager.Instance.InputManager.ShootEvent += Shoot;
|
||||
|
||||
}
|
||||
public bool IsAlive { get { return isAlive; } }
|
||||
|
||||
|
@ -43,9 +46,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
}
|
||||
isAlive = false;
|
||||
}
|
||||
public void AnimationJump()
|
||||
public void Jump()
|
||||
{
|
||||
velocity.Y = -300;
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
{
|
||||
velocity.Y = -300;
|
||||
}
|
||||
// здесь будет анимация
|
||||
}
|
||||
public void Shoot()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,16 @@ namespace DangerousD.GameCore
|
|||
|
||||
public void LoadSounds() // метод для загрузки звуков из папки
|
||||
{
|
||||
string[] soundFiles = Directory.GetFiles("../../../Content").Where(x=>x.EndsWith("mp3")).Select(x=>x.Split("\\").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
||||
foreach (var soundFile in soundFiles)
|
||||
var k = Directory.GetFiles("../../..//Content").Where(x => x.EndsWith("mp3"));
|
||||
if (k.Count() > 0)
|
||||
{
|
||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>(soundFile).CreateInstance());
|
||||
|
||||
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
||||
foreach (var soundFile in soundFiles)
|
||||
{
|
||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>(soundFile).CreateInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +39,7 @@ namespace DangerousD.GameCore
|
|||
sound.SoundEffect.IsLooped = false;
|
||||
sound.SoundEffect.Play();
|
||||
PlayingSounds.Add(sound);
|
||||
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host)
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Host)
|
||||
{
|
||||
AppManager.Instance.NetworkManager.SendMsg(new Network.NetworkTask(Vector2.Zero, soundName));
|
||||
}
|
||||
|
@ -45,7 +51,7 @@ namespace DangerousD.GameCore
|
|||
sound.SoundEffect.Volume = (float)sound.GetDistance(playerPos) / MaxSoundDistance;
|
||||
sound.SoundEffect.Play();
|
||||
PlayingSounds.Add(sound);
|
||||
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Host)
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Host)
|
||||
{
|
||||
AppManager.Instance.NetworkManager.SendMsg(new Network.NetworkTask(soundPos, soundName));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue