Fix namespaces, add collectable
This commit is contained in:
parent
74ec7f4deb
commit
19a7676b1d
17 changed files with 52 additions and 36 deletions
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DangerousD.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
|
@ -38,11 +38,13 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//events
|
//events DoorInteraction
|
||||||
public event EventHandler<CollisionComponent> OnTriggerEnter;
|
public event EventHandler<CollisionComponent> OnTriggerEnter;
|
||||||
public event EventHandler<CollisionComponent> OnTriggerZone;
|
public event EventHandler<CollisionComponent> OnTriggerZone;
|
||||||
public event EventHandler<CollisionComponent> OnTriggerExit;
|
public event EventHandler<CollisionComponent> OnTriggerExit;
|
||||||
|
|
||||||
|
public event EventHandler<CollisionComponent> OnTriggerInteract;
|
||||||
|
|
||||||
// methods-event
|
// methods-event
|
||||||
public void TriggerEnter(object component, Player player,
|
public void TriggerEnter(object component, Player player,
|
||||||
EventArgs e)
|
EventArgs e)
|
||||||
|
|
|
@ -5,6 +5,11 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateInteraction : UpdateData
|
public class UpdateInteraction : UpdateData
|
||||||
{
|
{
|
||||||
|
public UpdateInteraction(int id)
|
||||||
|
{
|
||||||
|
IdEntity = id;
|
||||||
|
}
|
||||||
|
|
||||||
public int IdEntity { get; set; }
|
public int IdEntity { get; set; }
|
||||||
public string UpdateType { get; set; }
|
public string UpdateType { get; set; }
|
||||||
}
|
}
|
|
@ -28,5 +28,15 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
||||||
{
|
{
|
||||||
public int IdEntity { get; set; } //Id объекта
|
public int IdEntity { get; set; } //Id объекта
|
||||||
public string UpdateType { get; protected set; } //тип обновления
|
public string UpdateType { get; protected set; } //тип обновления
|
||||||
|
|
||||||
|
public UpdateData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdateData(int idEntity)
|
||||||
|
{
|
||||||
|
this.IdEntity = idEntity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities
|
namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@ using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities
|
namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
||||||
public class Collectable : Interactable
|
public class Collectable : Interactable
|
||||||
|
@ -7,4 +10,9 @@ public class Collectable : Interactable
|
||||||
public Collectable(Vector2 position) : base(position)
|
public Collectable(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnInteraction(object sender, CollisionComponent e)
|
||||||
|
{
|
||||||
|
AppManager.Instance.server.AddData(new UpdateInteraction(Id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
||||||
|
|
||||||
|
@ -15,11 +16,9 @@ public class Door : Interactable
|
||||||
graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };
|
graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInteraction()
|
public override void OnInteraction(object sender, CollisionComponent e)
|
||||||
{
|
{
|
||||||
graphicsComponent.AnimationInit("DoorInteraction", isOpened);
|
graphicsComponent.AnimationSelect("DoorInteraction", isOpened);
|
||||||
graphicsComponent.StartAnimation();
|
graphicsComponent.AnimationStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ public class Interactable : Entity
|
||||||
{
|
{
|
||||||
collisionComponent.OnTriggerEnter += (sender, e) => ChangeInteraction(sender, e, true);
|
collisionComponent.OnTriggerEnter += (sender, e) => ChangeInteraction(sender, e, true);
|
||||||
collisionComponent.OnTriggerExit += (sender, e) => ChangeInteraction(sender, e, false);
|
collisionComponent.OnTriggerExit += (sender, e) => ChangeInteraction(sender, e, false);
|
||||||
|
collisionComponent.OnTriggerInteract += OnInteraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeInteraction(object sender, CollisionComponent e, bool isReady)
|
private void ChangeInteraction(object sender, CollisionComponent e, bool isReady)
|
||||||
|
@ -22,7 +23,7 @@ public class Interactable : Entity
|
||||||
AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady));
|
AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady));
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnInteraction()
|
public virtual void OnInteraction(object sender, CollisionComponent e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using ZoFo.GameCore.GameObjects.Entities;
|
using ZoFo.GameCore.GameObjects.Entities;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||||
public class LivingEntity : Entity
|
public class LivingEntity : Entity
|
||||||
|
|
|
@ -3,8 +3,8 @@ using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
|
||||||
using ZoFo.GameCore;
|
using ZoFo.GameCore;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects;
|
namespace ZoFo.GameCore.GameObjects;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZoFo.GameCore.GameManagers;
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.MapObjects
|
namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
using ZoFo.GameCore.ZoFo_graphics;
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Zofo.GameCore.ZoFo_grafics;
|
|
||||||
|
|
||||||
namespace DangerousD.GameCore.Graphics
|
namespace ZoFo.GameCore.Graphics
|
||||||
{
|
{
|
||||||
public class AnimationBuilder
|
public class AnimationBuilder
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using Microsoft.Xna.Framework;
|
using System;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Zofo.GameCore.ZoFo_grafics
|
namespace ZoFo.GameCore.Graphics
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AnimationContainer
|
public class AnimationContainer
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
using ZoFo.GameCore.GameObjects;
|
using System;
|
||||||
using ZoFo.GameCore.GameManagers;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Content;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using Microsoft.Xna.Framework;
|
||||||
using System.Text;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Zofo.GameCore.ZoFo_grafics;
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.ZoFo_graphics
|
namespace ZoFo.GameCore.Graphics
|
||||||
{
|
{
|
||||||
|
|
||||||
public class GraphicsComponent
|
public class GraphicsComponent
|
||||||
|
@ -129,7 +124,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AnimationInit(string animationId, bool reverse = false)
|
public void AnimationSelect(string animationId, bool reverse = false)
|
||||||
{
|
{
|
||||||
currentAnimation = animations.Find(x => x.Id == animationId);
|
currentAnimation = animations.Find(x => x.Id == animationId);
|
||||||
if (reverse)
|
if (reverse)
|
||||||
|
@ -151,7 +146,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
||||||
animating = true;
|
animating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StepAnimation()
|
public void AnimationStep()
|
||||||
{
|
{
|
||||||
currentFrame += step;
|
currentFrame += step;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1,019 KiB After Width: | Height: | Size: 1 MiB |
Loading…
Add table
Reference in a new issue