42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
using Microsoft.Xna.Framework;
|
||
|
|
||
|
using Syntriax.Engine.Core;
|
||
|
using Syntriax.Engine.Core.Abstract;
|
||
|
using Syntriax.Engine.Physics2D.Abstract;
|
||
|
|
||
|
namespace Syntriax.Engine.Physics2D;
|
||
|
|
||
|
public abstract class Collider2DBehaviourBase : BehaviourOverride, ICollider2D
|
||
|
{
|
||
|
public Action<IAssignableTransform>? OnTransformAssigned { get => GameObject.OnTransformAssigned; set => GameObject.OnTransformAssigned = value; }
|
||
|
public Action<ICollider2D, ICollider2D>? OnCollision { get; set; } = null;
|
||
|
|
||
|
public Vector2 OffsetPosition { get; set; } = Vector2.Zero;
|
||
|
public Vector2 OffsetScale { get; set; } = Vector2.One;
|
||
|
public float OffsetRotation { get; set; } = 0f;
|
||
|
|
||
|
ITransform IAssignableTransform.Transform => Transform;
|
||
|
|
||
|
|
||
|
public bool Assign(ITransform transform) => GameObject.Assign(transform);
|
||
|
|
||
|
public void RecalculateVertices()
|
||
|
{
|
||
|
throw new NotImplementedException();
|
||
|
}
|
||
|
|
||
|
public bool CheckCollision(ICollider2D collider)
|
||
|
{
|
||
|
return false;
|
||
|
|
||
|
OnCollision?.Invoke(this, collider);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
public abstract IReadOnlyList<Vector2> Vertices { get; }
|
||
|
}
|