Exemplo n.º 1
0
 private static void SendPositionChanged(ref GameObject gameObject, ref GameComponentSlot gameComponentSlot)
 {
     if (gameComponentSlot.Component != 0)
     {
         gameComponentSlot.GameComponent.OnPositionChanged(ref gameObject.Origin);
     }
 }
Exemplo n.º 2
0
        private void CreateComponentAtSlot(ref GameComponentSlot gameComponentSlot, MessageArgs messageArgs)
        {
            var gameComponent = (GameComponent)this.classRegistry.Get(messageArgs.DestinationComponent).Create();

            gameComponent.GameObject        = messageArgs.DestinationObject;
            gameComponent.Slot              = messageArgs.DestinationComponentSlot;
            gameComponentSlot.GameComponent = gameComponent;
            gameComponentSlot.Component     = messageArgs.DestinationComponent;
            gameComponentSlot.Slot          = messageArgs.DestinationComponentSlot;
        }
Exemplo n.º 3
0
        private static bool SendMessageToComponent(ref GameComponentSlot slot, MessageArgs msg)
        {
            if (slot.Component == 0)
            {
                return(false);
            }

            slot.GameComponent.HandleMessage(msg);
            return(msg.IsHandled);
        }
Exemplo n.º 4
0
        private void DestroyComponent(ref GameComponentSlot gameComponentSlot)
        {
            if (gameComponentSlot.Component == 0)
            {
                return;
            }

            this.componentsTrashQueue.Enqueue(gameComponentSlot.GameComponent);
            gameComponentSlot.GameComponent = null;
            gameComponentSlot.Component     = 0;
            gameComponentSlot.Slot          = 0;
        }
Exemplo n.º 5
0
        private bool CheckSlotAndDestroyIfMatch(ref GameComponentSlot gameComponentSlot, MessageArgs messageArgs)
        {
            if (gameComponentSlot.Component == 0)
            {
                return(false);
            }

            if (gameComponentSlot.Slot != messageArgs.DestinationComponentSlot)
            {
                return(false);
            }

            if (messageArgs.DestinationComponent != 0 && gameComponentSlot.Component != messageArgs.DestinationComponent)
            {
                return(false);
            }

            this.DestroyComponent(ref gameComponentSlot);
            return(true);
        }