コード例 #1
0
        public mg_jr_ParallaxLayer GetInstancedParallaxLayer(EnvironmentType _environment, EnvironmentVariant _variant, EnvironmentLayer _layer)
        {
            mg_jr_EnvironmentLayerID mg_jr_EnvironmentLayerID2 = new mg_jr_EnvironmentLayerID(_environment, _variant, _layer);

            if (!m_layerResources.ContainsKey(mg_jr_EnvironmentLayerID2))
            {
                Assert.Fail("No layer " + mg_jr_EnvironmentLayerID2.ToString() + " found");
            }
            GameObject gameObject = Object.Instantiate(m_layerResources[mg_jr_EnvironmentLayerID2]);

            return(gameObject.GetComponent <mg_jr_ParallaxLayer>());
        }
コード例 #2
0
        protected bool LoadResource(mg_jr_EnvironmentLayerID _id)
        {
            bool result = false;

            if (!m_layerResources.ContainsKey(_id))
            {
                GameObject gameObject = Resources.Load(_id.ResourceFileName()) as GameObject;
                if (gameObject != null)
                {
                    m_layerResources.Add(_id, gameObject);
                    result = true;
                }
                else
                {
                    DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "Couldn't load resource with id: " + _id.ToString() + ", and prefab name: " + _id.ResourceFileName());
                }
            }
            else
            {
                DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "Attempting to register same EnvironmentLayer resource twice");
            }
            return(result);
        }