Skip to content

Vovan675/Hexy-Engine

Repository files navigation

Hexy Engine

Hexy Engine is a game engine with editor that uses Mono for scripting.

  • Rendering abstraction (2D, 3D, materials, lighting)
  • Editor
    • Building standalone executable
    • Play mode
  • C# scripting

Editor Screenshot Screenshot_11

Example C# script

using System;
using System.Collections.Generic;
using Hexy;

namespace ScriptCustom
{
    class TestScript : Entity
    {
        public float speed = 3.0f;
        public void OnStart()
        {
            Console.WriteLine("Hello im OnStart() Function");
            
            var entities = FindEntitiesByName("Empty Entity");
            
            int count = 0;
            foreach(Entity entity in entities)
            {
                entity.GetComponent<NameComponent>().Name += "(" + count + ")";
                count++;
            }

            var mesh = GetComponent<MeshComponent>().mesh;

            var material = mesh.GetMaterial();
            material.Set("u_Albedo", new Vector3(1));
            material.Set("u_useAlbedoTexture", 0.0f);
            //material.Set("u_AlbedoTexture", new Texture2D("assets/textures/texture2.jpg"));
        }

        public void OnUpdate(float deltaTime)
        {
            TransformComponent comp = GetComponent<TransformComponent>();

            Vector3 translation = new Vector3(0);
            if (Input.IsKeyDown('A'))
                translation.x -= speed;
            if (Input.IsKeyDown('D'))
                translation.x += speed;
            if (Input.IsKeyDown('W'))
                translation.y += speed;
            if (Input.IsKeyDown('S'))
                translation.y -= speed;

            comp.position = comp.position + translation * deltaTime;
        }
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published