Merge branch 'main' into livingEntitiesVlad
This commit is contained in:
commit
0ad20e3638
4 changed files with 32 additions and 11 deletions
|
@ -16,6 +16,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
Width = 32;
|
Width = 32;
|
||||||
Height = 64;
|
Height = 64;
|
||||||
|
/*GraphicsComponent.actionOfAnimationEnd += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.GameOver);
|
||||||
|
};*/
|
||||||
}
|
}
|
||||||
public bool IsAlive { get { return isAlive; } }
|
public bool IsAlive { get { return isAlive; } }
|
||||||
|
|
||||||
|
@ -31,6 +35,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
if(monsterName == "Zombie")
|
if(monsterName == "Zombie")
|
||||||
{
|
{
|
||||||
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
|
//GraphicsComponent.actionOfAnimationEnd();
|
||||||
}
|
}
|
||||||
isAlive = false;
|
isAlive = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@ using System.Text;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.Graphics
|
namespace DangerousD.GameCore.Graphics
|
||||||
{
|
{
|
||||||
|
|
||||||
public class GraphicsComponent
|
public class GraphicsComponent
|
||||||
{
|
{
|
||||||
//public Action actionOfAnimationEnd;
|
public Action<string> actionOfAnimationEnd;
|
||||||
private List<AnimationContainer> animations;
|
private List<AnimationContainer> animations;
|
||||||
private List<Texture2D> textures;
|
private List<Texture2D> textures;
|
||||||
private List<string> texturesNames;
|
private List<string> texturesNames;
|
||||||
|
@ -115,8 +116,12 @@ namespace DangerousD.GameCore.Graphics
|
||||||
{
|
{
|
||||||
if (!currentAnimation.IsCycle)
|
if (!currentAnimation.IsCycle)
|
||||||
{
|
{
|
||||||
|
if(actionOfAnimationEnd != null)
|
||||||
|
{
|
||||||
|
actionOfAnimationEnd(currentAnimation.Id);
|
||||||
|
}
|
||||||
currentAnimation = neitralAnimation;
|
currentAnimation = neitralAnimation;
|
||||||
//actionOfAnimationEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
|
@ -199,4 +204,4 @@ namespace DangerousD.GameCore.Graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ using DangerousD.GameCore.Managers;
|
||||||
|
|
||||||
namespace DangerousD.GameCore
|
namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
public enum GameState { Menu, Options, Lobby, Game, Login }
|
public enum GameState { Menu, Options, Lobby, Game, Login, GameOver }
|
||||||
public class AppManager : Game
|
public class AppManager : Game
|
||||||
{
|
{
|
||||||
public static AppManager Instance { get; private set; }
|
public static AppManager Instance { get; private set; }
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.Managers
|
namespace DangerousD.GameCore.Managers
|
||||||
{
|
{
|
||||||
|
@ -21,10 +22,12 @@ namespace DangerousD.GameCore.Managers
|
||||||
public void SetResolution(Point resolution)
|
public void SetResolution(Point resolution)
|
||||||
{
|
{
|
||||||
settingsContainer.Resolution = resolution;
|
settingsContainer.Resolution = resolution;
|
||||||
|
AppManager.Instance.resolution = resolution;
|
||||||
}
|
}
|
||||||
public void SetMainVolume(float volume)
|
public void SetMainVolume(float volume)
|
||||||
{
|
{
|
||||||
settingsContainer.MainVolume = MainVolume;
|
settingsContainer.MainVolume = MainVolume;
|
||||||
|
///AppManager.Instance.SoundManager.
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SetMusicVolume(float volume)
|
public void SetMusicVolume(float volume)
|
||||||
|
@ -45,22 +48,30 @@ namespace DangerousD.GameCore.Managers
|
||||||
{
|
{
|
||||||
if (!File.Exists("GameSettings.txt"))
|
if (!File.Exists("GameSettings.txt"))
|
||||||
{
|
{
|
||||||
File.Create("GameSettings.txt");
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serializedObject = JsonConvert.DeserializeObject<SettingsContainer>(File.ReadAllText("GameSettings.txt"));
|
settingsContainer = JsonConvert.DeserializeObject<SettingsContainer>(File.ReadAllText("GameSettings.txt"));
|
||||||
|
SetIsFullScreen(settingsContainer.IsFullScreen);
|
||||||
|
SetMainVolume(settingsContainer.MainVolume);
|
||||||
|
SetMusicVolume(settingsContainer.MusicVolume);
|
||||||
|
SetResolution(settingsContainer.Resolution);
|
||||||
|
SetSoundEffectsVolume(settingsContainer.SoundEffectsVolume);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SaveSettings()
|
public void SaveSettings()
|
||||||
{
|
{
|
||||||
if (!File.Exists("GameSettings.txt"))
|
using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt"))
|
||||||
File.Create("GameSettings.txt");
|
{
|
||||||
File.WriteAllText("GameSettings.txt", JsonConvert.SerializeObject(settingsContainer));
|
string _str = JsonConvert.SerializeObject(settingsContainer);
|
||||||
|
streamWriter.Write(_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
[Serializable]
|
||||||
public class SettingsContainer
|
public class SettingsContainer
|
||||||
{
|
{
|
||||||
[JsonProperty("IsFullScreen")]
|
[JsonProperty("IsFullScreen")]
|
||||||
|
|
Loading…
Add table
Reference in a new issue