Пример #1
0
        public ModelComposition(AssetTypeDefinition definition, BasePieceModel modelLeft, BasePieceModel modelRight, GameObject additionalData)
        {
            AssetTypeDefinition       = definition;
            _modelLeft                = modelLeft;
            _modelRight               = modelRight;
            AdditionalInstanceHandler = new AdditionalInstanceHandler(additionalData);

            if (_modelLeft == null && _modelRight == null)
            {
                return;
            }

            if (_modelLeft != null)
            {
                _modelLeft.ModelComposition          = this;
                _modelLeft.AdditionalInstanceHandler = AdditionalInstanceHandler;
                _modelLeft.Init();

                _metaData = modelLeft.GetMetaData();
            }

            if (_modelRight != null)
            {
                _modelRight.ModelComposition          = this;
                _modelRight.AdditionalInstanceHandler = AdditionalInstanceHandler;
                _modelRight.Init();
            }
        }
Пример #2
0
        /// <summary>
        /// Copy settings from the specified model to the other (if it exists)
        /// </summary>
        /// <param name="syncModel">Model to copy from</param>
        public void Sync(BasePieceModel syncModel)
        {
            var otherModel = _modelLeft == syncModel ? _modelRight : _modelLeft;

            otherModel?.SyncFrom(syncModel);
        }