Merge branch 'черешня' of https://github.com/progtime-net/DangerousD into черешня
This commit is contained in:
commit
ce40ddab57
16 changed files with 176 additions and 12 deletions
|
@ -81,6 +81,18 @@
|
|||
/processorParam:TextureFormat=Color
|
||||
/build:deathBackground.jpg
|
||||
|
||||
#begin Diamond.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:Diamond.png
|
||||
|
||||
#begin door.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
@ -121,6 +133,18 @@
|
|||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font2.spritefont
|
||||
|
||||
#begin GetScore.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:GetScore.png
|
||||
|
||||
#begin menuFon.jpg
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
@ -273,6 +297,36 @@
|
|||
/processorParam:TextureFormat=Color
|
||||
/build:textboxbackground1-1.png
|
||||
|
||||
#begin sounds/collected_coins.mp3
|
||||
/importer:Mp3Importer
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/collected_coins.mp3
|
||||
|
||||
#begin sounds/DoomTestSong.mp3
|
||||
/importer:Mp3Importer
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/DoomTestSong.mp3
|
||||
|
||||
#begin sounds/shotgun_shot.mp3
|
||||
/importer:Mp3Importer
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/shotgun_shot.mp3
|
||||
|
||||
#begin sounds/z1.mp3
|
||||
/importer:Mp3Importer
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/z1.mp3
|
||||
|
||||
#begin sounds/z3.mp3
|
||||
/importer:Mp3Importer
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/z3.mp3
|
||||
|
||||
#begin textboxbackground2-1.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
|
BIN
DangerousD/Content/Diamond.png
Normal file
BIN
DangerousD/Content/Diamond.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
DangerousD/Content/GetScore.png
Normal file
BIN
DangerousD/Content/GetScore.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
1
DangerousD/Content/animations/Diamond
Normal file
1
DangerousD/Content/animations/Diamond
Normal file
|
@ -0,0 +1 @@
|
|||
{"id":"Diamond","textureName":"Diamond","startSpriteRectangle":{"X":0,"Y":0,"Width":128,"Height":128},"frameSecond":[{"Item1":0,"Item2":15}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}
|
20
DangerousD/Content/animations/score100
Normal file
20
DangerousD/Content/animations/score100
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"id": "score100",
|
||||
"textureName": "GetScore",
|
||||
"startSpriteRectangle": {
|
||||
"X": 0,
|
||||
"Y": 0,
|
||||
"Width": 32,
|
||||
"Height": 32
|
||||
},
|
||||
"frameSecond": [
|
||||
{
|
||||
"Item1": 0,
|
||||
"Item2": 10
|
||||
}
|
||||
],
|
||||
"textureFrameInterval": 1,
|
||||
"framesCount": 3,
|
||||
"isCycle": false,
|
||||
"offset": "1, 0"
|
||||
}
|
20
DangerousD/Content/animations/score600
Normal file
20
DangerousD/Content/animations/score600
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"id": "score600",
|
||||
"textureName": "GetScore",
|
||||
"startSpriteRectangle": {
|
||||
"X": 0,
|
||||
"Y": 33,
|
||||
"Width": 32,
|
||||
"Height": 32
|
||||
},
|
||||
"frameSecond": [
|
||||
{
|
||||
"Item1": 0,
|
||||
"Item2": 10
|
||||
}
|
||||
],
|
||||
"textureFrameInterval": 1,
|
||||
"framesCount": 3,
|
||||
"isCycle": false,
|
||||
"offset": "1, 0"
|
||||
}
|
BIN
DangerousD/Content/sounds/collected_coins.mp3
Normal file
BIN
DangerousD/Content/sounds/collected_coins.mp3
Normal file
Binary file not shown.
BIN
DangerousD/Content/sounds/z1.mp3
Normal file
BIN
DangerousD/Content/sounds/z1.mp3
Normal file
Binary file not shown.
BIN
DangerousD/Content/sounds/z3.mp3
Normal file
BIN
DangerousD/Content/sounds/z3.mp3
Normal file
Binary file not shown.
|
@ -7,13 +7,14 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using DangerousD.GameCore.GameObjects.Entities.Items;
|
||||
|
||||
namespace DangerousD.GameCore.GameObjects.Entities
|
||||
{
|
||||
public class Door : Entity
|
||||
{
|
||||
private Rectangle _sourceRectangle;
|
||||
|
||||
Random random = new Random();
|
||||
public Door(Vector2 position, Vector2 size, Rectangle sourceRectangle) : base(position)
|
||||
{
|
||||
_sourceRectangle = sourceRectangle;
|
||||
|
@ -46,6 +47,11 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
|||
{
|
||||
AppManager.Instance.GameManager.Remove(this);
|
||||
//тут спавн лута
|
||||
for (int i = 0; i < random.Next(0,15); i++)
|
||||
{
|
||||
var d = new Diamond(Vector2.Zero);
|
||||
d.SetPosition(Pos + new Vector2(random.Next(-30, 30), Height - d.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,32 @@
|
|||
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||
using DangerousD.GameCore.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static System.Formats.Asn1.AsnWriter;
|
||||
|
||||
namespace DangerousD.GameCore.GameObjects.Entities.Items;
|
||||
|
||||
public class Diamond : Entity
|
||||
{
|
||||
Random random = new Random();
|
||||
public Diamond(Vector2 position) : base(position)
|
||||
{
|
||||
int scal = random.Next(3, 12);
|
||||
Width = scal;
|
||||
Height = scal;
|
||||
GraphicsComponent.StartAnimation("Diamond");
|
||||
}
|
||||
|
||||
protected override GraphicsComponent GraphicsComponent { get; }
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List<string>() { "Diamond" }, "Diamond");
|
||||
public override void OnCollision(GameObject gameObject)
|
||||
{
|
||||
if (gameObject is Player)
|
||||
{
|
||||
AppManager.Instance.GameManager.Remove(this);
|
||||
new ScoreText(Pos, ScoreText.scores[random.Next(0, ScoreText.scores.Length-1)]);
|
||||
AppManager.Instance.SoundManager.StartSound("collected_coins", Pos, Pos);
|
||||
}
|
||||
base.OnCollision(gameObject);
|
||||
}
|
||||
}
|
34
DangerousD/GameCore/GameObjects/Entities/Items/ScoreText.cs
Normal file
34
DangerousD/GameCore/GameObjects/Entities/Items/ScoreText.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||
using DangerousD.GameCore.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DangerousD.GameCore.GameObjects.Entities.Items
|
||||
{
|
||||
internal class ScoreText : Entity
|
||||
{
|
||||
public static int[] scores = new int[] { 100, 600};
|
||||
public ScoreText(Vector2 position, int score) : base(position)
|
||||
{
|
||||
Width = 32;
|
||||
Height = 32;
|
||||
GraphicsComponent.StartAnimation("score"+ score);
|
||||
GraphicsComponent.actionOfAnimationEnd += (a) => { AppManager.Instance.GameManager.Remove(this); };
|
||||
}
|
||||
public override void Initialize()
|
||||
{
|
||||
}
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
_pos.Y -= 1.0f;
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List<string>() { "score100", "score600" }, "score100");
|
||||
|
||||
}
|
||||
}
|
|
@ -186,6 +186,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
public override void TakeDamage()
|
||||
{
|
||||
if (monster_health == 3)
|
||||
AppManager.Instance.SoundManager.StartSound("z3", Pos, Pos);
|
||||
if (monster_health == 2)
|
||||
AppManager.Instance.SoundManager.StartSound("z1", Pos, Pos);
|
||||
if (monster_health == 1)
|
||||
AppManager.Instance.SoundManager.StartSound("z3", Pos, Pos);
|
||||
monster_health--;
|
||||
Particle particle = new Particle(Pos);
|
||||
if (monster_health <= 0)
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
public bool isUping = false;
|
||||
public bool isNetworkPlayer;
|
||||
private int shootLength = 160;
|
||||
public int score = 0;
|
||||
|
||||
|
||||
|
||||
|
@ -186,6 +187,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
{
|
||||
if (!isShooting)
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartSound("shotgun_shot", Pos, Pos);
|
||||
isShooting = true;
|
||||
bullets--;
|
||||
if (isRight)
|
||||
|
|
|
@ -148,8 +148,10 @@ namespace DangerousD.GameCore
|
|||
item.Update(gameTime);
|
||||
foreach (var item in mapObjects)
|
||||
item.Update(gameTime);
|
||||
foreach (var item in entities)
|
||||
item.Update(gameTime);
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
entities[i].Update(gameTime);
|
||||
}
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Client)
|
||||
{
|
||||
for (int i = 0; i < livingEntitiesWithoutPlayers.Count; i++)
|
||||
|
@ -172,7 +174,7 @@ namespace DangerousD.GameCore
|
|||
}
|
||||
}
|
||||
GetPlayer1.Update(gameTime);
|
||||
for(int i = 0; i < otherObjects.Count; i++)
|
||||
for (int i = 0; i < otherObjects.Count; i++)
|
||||
{
|
||||
otherObjects[i].Update(gameTime);
|
||||
}
|
||||
|
@ -183,7 +185,7 @@ namespace DangerousD.GameCore
|
|||
{
|
||||
foreach (var item in GetAllGameObjects)
|
||||
{
|
||||
if (item.Pos.X<CameraBorder.X)
|
||||
if (item.Pos.X < CameraBorder.X)
|
||||
{
|
||||
CameraBorder.X = item.Pos.X;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace DangerousD.GameCore
|
|||
{
|
||||
public class SoundManager
|
||||
{
|
||||
public Dictionary<string, SoundEffectInstance> Sounds = new Dictionary<string, SoundEffectInstance>(); // словарь со звуками где строка - название файла
|
||||
public Dictionary<string, SoundEffect> Sounds = new Dictionary<string, SoundEffect>(); // словарь со звуками где строка - название файла
|
||||
public List<Sound> PlayingSounds = new List<Sound>(); // список со всеми звуками, которые проигрываются
|
||||
public float MaxSoundDistance = 1500; // максимальная дальность звука
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace DangerousD.GameCore
|
|||
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>("sounds//" + soundFile).CreateInstance());
|
||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace DangerousD.GameCore
|
|||
|
||||
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
||||
{
|
||||
var sound = new Sound(Sounds[soundName]);
|
||||
var sound = new Sound(Sounds[soundName].CreateInstance());
|
||||
sound.SoundEffect.IsLooped = false;
|
||||
sound.SoundEffect.Play();
|
||||
PlayingSounds.Add(sound);
|
||||
|
@ -51,7 +51,7 @@ namespace DangerousD.GameCore
|
|||
}
|
||||
public void StartSound(string soundName, Vector2 soundPos, Vector2 playerPos) // запустить звук у которого есть позиция
|
||||
{
|
||||
var sound = new Sound(Sounds[soundName], soundPos);
|
||||
var sound = new Sound(Sounds[soundName].CreateInstance(), soundPos);
|
||||
sound.SoundEffect.IsLooped = false;
|
||||
sound.SoundEffect.Volume = (float)(MaxSoundDistance-sound.GetDistance(playerPos)) / MaxSoundDistance;
|
||||
sound.SoundEffect.Play();
|
||||
|
@ -71,7 +71,7 @@ namespace DangerousD.GameCore
|
|||
|
||||
public void Update() // апдейт, тут происходит изменение громкости
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
var player = AppManager.Instance.GameManager.GetPlayer1;
|
||||
if (player != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue