Exemple #1
0
    public static flash.display.Sprite getPicNodeAndAddTo(MovieClip mainMovieClip_, Transform parent_)
    {
        flash.display.Sprite sprite = GameObject.Instantiate(_spriteCache);
        sprite.setMainMovieClip(mainMovieClip_);
        Transform _spTrans = sprite.transform;

        _spTrans.parent        = parent_;
        _spTrans.localPosition = new Vector3(0f, 0f, 0f);
        _spTrans.localScale    = new Vector3(1f, 1f, 1f);
        return(sprite);
    }
Exemple #2
0
 //Create object for 'GameObject.Instantiate()'
 public static void createCache()
 {
     if (_spriteCache == null)
     {
         _spriteCache = new GameObject().AddComponent <flash.display.Sprite> ();
         _spriteCache.gameObject.name = "cache_FlashUtils_Sprite";
         _spriteCache.spriteRenderer  = _spriteCache.GetComponent <SpriteRenderer> ();
         _spriteCache.spriteRenderer.shadowCastingMode = ShadowCastingMode.Off;
         _spriteCache.spriteRenderer.receiveShadows    = false;
         _spriteCache.spriteRenderer.material          = new Material(spriteRendererShader);
     }
     if (_movieClipCache == null)
     {
         _movieClipCache = new GameObject().AddComponent <MovieClip> ();
         _movieClipCache.gameObject.name = "cache_FlashUtils_MovieClip";
     }
 }
Exemple #3
0
    /*  */
    private void init()
    {
        // GAME GFX AND UI INIT
        if (state == GAME || state == MENU)
        {
            renderer.createRenderLayers(this);
        }

        addChild(transition);

        if (focusPrompt == null)
        {
            focusPrompt = new Sprite();
            focusPrompt.addChild(screenText("click"));
            //stage.addEventListener(Event.DEACTIVATE, onFocusLost);
            //stage.addEventListener(Event.ACTIVATE, onFocus);
        }

        if (state == GAME || state == MENU)
        {
            frameCount       = 1;
            currentLevel     = 0;
            currentLevelType = TEST_BED_INIT ? Room.ADVENTURE : Room.PUZZLE;
            currentLevelObj  = null;
            titleMenu        = new TitleMenu();
            if (state == GAME)
            {
                initLevel();
            }
        }

        addListeners();

        // this is a hack to force clicking on the game when the browser first pulls in the swf
        if (forceFocus)
        {
            onFocusLost();
            forceFocus = false;
        }
        else
        {
        }
    }