コード例 #1
0
        private void ReplaceSelectedIfReceiver(Collider2D collider)
        {
            if (collider == null || collider.gameObject == null)
            {
                return;
            }

            GameEntity entity = GameLinkUtils.GetEntity(collider.gameObject);

            if (entity == null)
            {
                return;
            }

            if (!entity.hasReceiver)
            {
                return;
            }

            if (!ReceiverUtils.Filter(entity.receiver, m_ComponentIndex))
            {
                return;
            }

            GameEntity selectedEntity = m_Context.CreateEntity();

            selectedEntity.isSelected = true;
            ReceiverUtils.AddOccupant(entity, selectedEntity.id.value);
        }
コード例 #2
0
        /// <summary>
        /// During initialization, converts filter component names to indexes.
        /// Otherwise, if the component indexes changed after editing this view, the indexes would mismatch.
        /// </summary>
        public override void Initialize()
        {
            InitializeOccupants();

            if (m_FilterComponentNames != null)
            {
                ToComponentIndexes(m_FilterComponentNames, ref m_Component.filterComponentIndexes);
            }

            base.Initialize();

            GameEntity receiverEntity = GameLinkUtils.GetEntity(gameObject);

            receiverEntity.AddReceiverListener(this);
        }