updateLoot

This commit is contained in:
Kaktus200020 2024-08-18 00:31:53 +03:00
parent 85b55f6f41
commit 8eab09980a
10 changed files with 132 additions and 5 deletions

View file

@ -24,9 +24,9 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
}
void Initialize()
{
tagItemPairs.Add("wood", new ItemInfo("wood","wood",false,null));
tagItemPairs.Add("rock", new ItemInfo("rock", "rock", false, null));
tagItemPairs.Add("steel", new ItemInfo("steel", "steel", false, null));
tagItemPairs.Add("Wood", new ItemInfo("Wood","Wood",false,null));
tagItemPairs.Add("Peeble", new ItemInfo("Peeble", "Peeble", false, null));
tagItemPairs.Add("Steel", new ItemInfo("Steel", "Steel", false, null));
}
}

View file

@ -11,6 +11,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
/// </summary>
public class UpdateLoot : UpdateData
{
public UpdateLoot() { UpdateType = "UpdateLoot"; }
public string lootName;
public UpdateLoot() { UpdateType = "UpdateLoot"; }
public UpdateLoot(string lootName)
{
UpdateType = "UpdateLoot";
this.lootName = lootName;
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class Ammo:Collectable
{
public override GraphicsComponent graphicsComponent { get; } = new(new List<string> { "Ammo" }, "Ammo");
public Ammo(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Ammo"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class Antiradine:Collectable
{
public override GraphicsComponent graphicsComponent { get; } = new(new List<string> { "Antiradine" }, "Antiradine");
public Antiradine(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Antiradine"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -6,6 +6,9 @@ using System.Threading.Tasks;
using ZoFo.GameCore.Graphics;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
@ -16,6 +19,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("BottleOfWater"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -5,6 +5,9 @@ using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.Graphics;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
@ -17,5 +20,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Peeble"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -4,6 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
@ -15,5 +18,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
public PureBottleOfWater(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("PureBottleOfWater"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
{
class RottenFlesh:Collectable
{
public override GraphicsComponent graphicsComponent { get; } = new(new List<string> { "RottenFlesh" }, "RottenFlesh");
public RottenFlesh(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("RottenFlesh"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -4,6 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
@ -15,5 +18,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables
public Steel(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Steel"));
AppManager.Instance.server.DeleteObject(this);
}
}
}

View file

@ -1,5 +1,8 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using ZoFo.GameCore.GameManagers;
using ZoFo.GameCore.GameManagers.CollisionManager;
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
using ZoFo.GameCore.Graphics;
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
@ -10,5 +13,11 @@ public class Wood : Collectable
public Wood(Vector2 position) : base(position)
{
}
public override void OnInteraction(object sender, CollisionComponent e)
{
AppManager.Instance.server.AddData(new UpdateLoot("Wood"));
AppManager.Instance.server.DeleteObject(this);
}
}