Ejemplo n.º 1
0
        public static void DestroyHActor(HActor hActor)
        {
            var gameObject = hActor.GameObject;

            HEvents <DestroyedGameObject> .AddEvent(new DestroyedGameObject(gameObject, hActor));

            HCleanUp.Destroy(hActor);
        }
Ejemplo n.º 2
0
        public override void Start()
        {
            //constraint.ForEachGameObject((hActor, cube) =>
            //{
            //    cube.Scale = hActor.GameObject.transform.localScale;
            //});

            HEvents <TestEvent> .AddHandler(Handle);
        }
Ejemplo n.º 3
0
        public static HActor AddHActor(GameObject gameObject)
        {
            HActor hActor = new HActor();

            hActor.GameObject = gameObject;
            hActor.CreateMask();
            HActors.hActors.Add(hActor);
            HEvents <AddedGameObject> .AddEvent(new AddedGameObject(gameObject, hActor));

            return(hActor);
        }
Ejemplo n.º 4
0
        public static bool DestroyComponent <C>(HActor hActor) where C : HComponent
        {
            C component = null;

            if (!hActor.TryGetComponents <C>(out component))
            {
                return(false);
            }

            HEvents <DestroyedComponent <C> > .AddEvent(new DestroyedComponent <C>(component, hActor));

            HCleanUp <C> .Destroy(hActor, component);

            return(true);
        }
Ejemplo n.º 5
0
        public static C AddHComponent <C>(HActor hActor) where C : HComponent
        {
            C component = null;

            if (!hActor.TryGetComponents <C>(out component))
            {
                component = Activator.CreateInstance <C>();
                hActor.mask[HComponentIDs.Get(typeof(C))] = true;
                hActor.hComponents[typeof(C)]             = component;
                //HSystems.Insert(hActor);
                HEvents <AddedComponent <C> > .AddEvent(new AddedComponent <C>(component, hActor));
            }

            return(component);
        }
Ejemplo n.º 6
0
        public override void Update()
        {
            constraint.ForEachGameObject((hActor, cube) =>
            {
                hActor.GameObject.transform.localPosition += (Vector3.one * cube.Speed);
                cube.Pos = hActor.GameObject.transform.localPosition;

                if (cube.Pos.x > 100)
                {
                    HEvents <TestEvent> .AddEvent(new TestEvent("Test!!!"));
                    //Helper.DestroyComponent<CubeComponent2>(hActor);
                    Helper.DestroyHActor(hActor);
                }
            });
        }
Ejemplo n.º 7
0
        public static void Update()
        {
            foreach (var system in activeSystems)
            {
#if UNITY_EDITOR
                if (system.enabled)
                {
                    system.Update();
                }
#else
                system.Update();
#endif
            }

            HEvents.Invoke();

            HCleanUp.CleanUp();
        }
Ejemplo n.º 8
0
        public static void Start()
        {
            activeSystems.Clear();
            foreach (var system in _systems)
            {
                foreach (var hActor in HActors.hActors)
                {
                    system.CreateBundle(hActor);
                }
            }

            HEvents.Start();

            foreach (var system in activeSystems)
            {
                system.Start();
            }

            HEvents.Invoke();

            HCleanUp.CleanUp();
        }