ZoFo/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs

70 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.Win32;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameObjects;
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
namespace ZoFo.GameCore.GameManagers.CollisionManager
{
public class CollisionComponent
{
//==КОНСТРУКТОР==
public CollisionComponent(GameObject gameObject)
{
this.gameObject = gameObject;
hasCollision = false;
this.isTrigger = false;
}
public CollisionComponent(GameObject gameObject, bool hasCollision = false, Rectangle? collisionRectangle = null, bool isTrigger = false, Rectangle? triggerRectangle = null)
{
this.gameObject = gameObject;
this.hasCollision = hasCollision;
this.isTrigger = isTrigger;
if (hasCollision)
this.stopRectangle = collisionRectangle.Value;
if (isTrigger)
this.triggerRectangle = triggerRectangle.Value;
}
//==ПОЛЯ==
public GameObject gameObject { get; set; }
bool doesStop;
bool hasCollision;
public Rectangle stopRectangle;
// triggers for rectangle
bool isTrigger;
public Rectangle triggerRectangle;
//delegate
public delegate void EventHandler(object sender, EventArgs e);
//events DoorInteraction
public event EventHandler<CollisionComponent> OnTriggerEnter;
public event EventHandler<CollisionComponent> OnTriggerZone;
public event EventHandler<CollisionComponent> OnTriggerExit;
public event EventHandler<CollisionComponent> OnCollision;
}
}