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

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

            HCleanUp.Destroy(hActor);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 public AddedGameObject(GameObject gameObject, HActor hActor)
 {
     this.gameObject = gameObject;
     this.hActor     = hActor;
 }
Exemplo n.º 6
0
 public DestroyedGameObject(GameObject gameObject, HActor hActor)
 {
     this.gameObject = gameObject;
     this.hActor     = hActor;
 }
Exemplo n.º 7
0
 public void RemoveBundle(HActor hActor)
 {
     rootBundles.Remove(hActor);
 }
Exemplo n.º 8
0
 public abstract bool CreateBundle(HActor hActor);
Exemplo n.º 9
0
        protected bool CanUpdate(HActor hActor)
        {
            var comparisonMask = new BitMask(hActor.mask).And(_mask);

            return(comparisonMask == _mask);
        }
Exemplo n.º 10
0
 public static void Destroy(HActor hActor)
 {
     hActor.hComponents.Clear();
     _destroyedGameObjects.Add(hActor.GameObject);
 }