private GameObject DeviceSpecificMerge()
        {
            DeviceBehaviorBase otherRootDevice = otherRootParent.GetComponent <DeviceBehaviorBase>();
            DeviceBehaviorBase thisRootDevice  = thisRootParent.GetComponent <DeviceBehaviorBase>();

            if (otherRootDevice == null || thisRootDevice == null)
            {
                Debug.LogError("could not merge. device behavior not found");
                return(null);
            }

            switch (otherRootDevice.GetDeviceType())
            {
            case Devices.DeviceType.BASIC:
                if (thisRootDevice.IsBasicDevice)
                {
                    return(DeviceSpawner.Instance.MergeBasicDevices((BasicDevice)otherRootDevice, (BasicDevice)thisRootDevice));
                }
                if (thisRootDevice.IsTwoPieceDevice)
                {
                    return(DeviceSpawner.Instance.MergeBasicAndTwoPiece((BasicDevice)otherRootDevice, (TwoPieceDevice)thisRootDevice));
                }
                return(null);

            case Devices.DeviceType.TWO_PIECE:
                if (thisRootDevice.IsBasicDevice)
                {
                    return(DeviceSpawner.Instance.MergeBasicAndTwoPiece((BasicDevice)thisRootDevice, (TwoPieceDevice)otherRootDevice));
                }
                return(null);

            default:
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        /// Starts the placing for the game object.
        /// </summary>
        /// <param name="go"></param>
        protected void PlaceTheGameObject(GameObject go)
        {
            DeviceBehaviorBase db = go.GetComponent <DeviceBehaviorBase>();

            if (db == null)
            {
                Debug.LogErrorFormat("could not find DeviceBehaviorBase for {0}", go.name);
                return;
            }
            db.StartPlacing();
        }