Пример #1
0
        public override GameObject Create()
        {
            GameObject gameObject = base.Create();

            SpriteRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <SpriteRenderer>();
            SpriteRenderer[] array = componentsInChildren;
            foreach (SpriteRenderer spriteRenderer in array)
            {
                switch (spriteRenderer.gameObject.name)
                {
                case "Cloud":
                    spriteRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_0);
                    break;

                case "Effect":
                    spriteRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_1);
                    break;

                case "Lightning":
                    spriteRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_2);
                    break;

                default:
                    Assert.IsTrue(condition: false, "Stormy cloud - unknown renderer object name: " + spriteRenderer.gameObject.name);
                    break;
                }
            }
            mg_jr_PlayOnAppearance mg_jr_PlayOnAppearance2 = gameObject.AddComponent <mg_jr_PlayOnAppearance>();

            mg_jr_PlayOnAppearance2.SfxToPlay = mg_jr_Sound.STORM_CLOUD.ClipName();
            return(gameObject);
        }
Пример #2
0
        public override GameObject Create()
        {
            GameObject gameObject = null;

            gameObject = base.Resources.GetInstancedResource(m_resourceId);
            Assert.NotNull(gameObject, "No gameobject created.");
            SpriteRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <SpriteRenderer>();
            SpriteRenderer[] array = componentsInChildren;
            foreach (SpriteRenderer spriteRenderer in array)
            {
                switch (spriteRenderer.gameObject.name)
                {
                case "whale":
                    spriteRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_0);
                    break;

                case "water":
                    spriteRenderer.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_1);
                    break;

                default:
                    Assert.IsTrue(condition: false, "mg_jr_WhaleFactory - unknown renderer object name: " + spriteRenderer.gameObject.name);
                    break;
                }
            }
            mg_jr_PlayOnAppearance mg_jr_PlayOnAppearance2 = gameObject.AddComponent <mg_jr_PlayOnAppearance>();

            mg_jr_PlayOnAppearance2.SfxToPlay = mg_jr_Sound.WHALE.ClipName();
            Collider2D component = gameObject.GetComponent <Collider2D>();

            Assert.NotNull(component, "Whales must have a collider on the root object");
            if (component.gameObject.GetComponent <mg_jr_Whale>() == null)
            {
                component.gameObject.AddComponent <mg_jr_Whale>();
            }
            return(gameObject);
        }