add project work
This commit is contained in:
@ -32,6 +32,16 @@ namespace Hazel
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern static void RigidBody2DComponent_ApplyLinearImpulseToCenter(ulong entityID, ref Vector2 impulse, bool wake);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern static void RigidBody2DComponent_GetLinearVelocity(ulong entityID, out Vector2 LinearVelocity);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern static RigidBody2DComponent.BodyType RigidBody2DComponent_GetType(ulong entityID);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern static void RigidBody2DComponent_SetType(ulong entityID, RigidBody2DComponent.BodyType bodyType);
|
||||
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal extern static bool Input_IsKeyDown(KeyCode keycode);
|
||||
}
|
||||
|
||||
@ -21,6 +21,23 @@ namespace Hazel
|
||||
|
||||
public class RigidBody2DComponent : Component
|
||||
{
|
||||
public enum BodyType { Static = 0, Dynamic, Kinematic}
|
||||
|
||||
public Vector2 LinearVelocity
|
||||
{
|
||||
get
|
||||
{
|
||||
InternalCalls.RigidBody2DComponent_GetLinearVelocity(Entity.ID, out Vector2 velocity);
|
||||
return velocity;
|
||||
}
|
||||
}
|
||||
|
||||
public BodyType Type
|
||||
{
|
||||
get => InternalCalls.RigidBody2DComponent_GetType(Entity.ID);
|
||||
set => InternalCalls.RigidBody2DComponent_SetType(Entity.ID, value);
|
||||
}
|
||||
|
||||
public void ApplyLinearImpulse(Vector2 impulse, Vector2 point, bool wake) {
|
||||
InternalCalls.RigidBody2DComponent_ApplyLinearImpulse(Entity.ID, ref impulse, ref point, wake);
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace Hazel
|
||||
{
|
||||
@ -26,6 +27,16 @@ namespace Hazel
|
||||
{
|
||||
return new Vector2(a.X + b.X, a.Y + b.Y);
|
||||
}
|
||||
|
||||
public float LengthSquared()
|
||||
{
|
||||
return X * X + Y * Y;
|
||||
}
|
||||
|
||||
public float Length()
|
||||
{
|
||||
return (float)Math.Sqrt(LengthSquared());
|
||||
}
|
||||
}
|
||||
|
||||
public struct Vector3
|
||||
|
||||
Reference in New Issue
Block a user