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.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DangerousD.GameCore.Graphics;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
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> OnTriggerZone;
|
||||
public event EventHandler<CollisionComponent> OnTriggerExit;
|
||||
|
||||
public event EventHandler<CollisionComponent> OnTriggerInteract;
|
||||
|
||||
// methods-event
|
||||
public void TriggerEnter(object component, Player player,
|
||||
EventArgs e)
|
||||
|
|
|
@ -5,6 +5,11 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
|||
/// </summary>
|
||||
public class UpdateInteraction : UpdateData
|
||||
{
|
||||
public UpdateInteraction(int id)
|
||||
{
|
||||
IdEntity = id;
|
||||
}
|
||||
|
||||
public int IdEntity { get; set; }
|
||||
public string UpdateType { get; set; }
|
||||
}
|
|
@ -28,5 +28,15 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
|||
{
|
||||
public int IdEntity { get; set; } //Id объекта
|
||||
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.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Text;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
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;
|
||||
public class Collectable : Interactable
|
||||
|
@ -7,4 +10,9 @@ public class Collectable : Interactable
|
|||
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 Microsoft.Xna.Framework;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
||||
|
||||
|
@ -15,11 +16,9 @@ public class Door : Interactable
|
|||
graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };
|
||||
}
|
||||
|
||||
public override void OnInteraction()
|
||||
public override void OnInteraction(object sender, CollisionComponent e)
|
||||
{
|
||||
graphicsComponent.AnimationInit("DoorInteraction", isOpened);
|
||||
graphicsComponent.StartAnimation();
|
||||
graphicsComponent.AnimationSelect("DoorInteraction", isOpened);
|
||||
graphicsComponent.AnimationStep();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ using ZoFo.GameCore.GameManagers;
|
|||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
||||
|
||||
|
@ -15,6 +15,7 @@ public class Interactable : Entity
|
|||
{
|
||||
collisionComponent.OnTriggerEnter += (sender, e) => ChangeInteraction(sender, e, true);
|
||||
collisionComponent.OnTriggerExit += (sender, e) => ChangeInteraction(sender, e, false);
|
||||
collisionComponent.OnTriggerInteract += OnInteraction;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public virtual void OnInteraction()
|
||||
public virtual void OnInteraction(object sender, CollisionComponent e)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameObjects.Entities;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities;
|
||||
public class LivingEntity : Entity
|
||||
|
|
|
@ -3,8 +3,8 @@ using Microsoft.Xna.Framework;
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
using ZoFo.GameCore.Graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Zofo.GameCore.ZoFo_grafics;
|
||||
|
||||
namespace DangerousD.GameCore.Graphics
|
||||
namespace ZoFo.GameCore.Graphics
|
||||
{
|
||||
public class AnimationBuilder
|
||||
{
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Zofo.GameCore.ZoFo_grafics
|
||||
namespace ZoFo.GameCore.Graphics
|
||||
{
|
||||
[Serializable]
|
||||
public class AnimationContainer
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
using ZoFo.GameCore.GameObjects;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using Zofo.GameCore.ZoFo_grafics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ZoFo.GameCore.GameManagers;
|
||||
|
||||
namespace ZoFo.GameCore.ZoFo_graphics
|
||||
namespace ZoFo.GameCore.Graphics
|
||||
{
|
||||
|
||||
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);
|
||||
if (reverse)
|
||||
|
@ -151,7 +146,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
animating = true;
|
||||
}
|
||||
|
||||
public void StepAnimation()
|
||||
public void AnimationStep()
|
||||
{
|
||||
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