Play() public method

public Play ( string name, bool loop = true ) : void
name string
loop bool
return void
コード例 #1
0
ファイル: Example.cs プロジェクト: rvdveen/Futile-SpineSprite
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);

        fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);
        Futile.instance.Init(fparams);

        // Load the powerup sprite
        GSpineManager.LoadSpine("powerup", "spine/powerup/powerupJson", "spine/powerup/powerupAtlas");
        powerup = new GSpineSprite("powerup");
        Futile.stage.AddChild(powerup);
        powerup.Play("animation");
        powerup.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        _activeSprite = powerup;

        // load the goblin sprite
        GSpineManager.LoadSpine("goblin", "spine/goblin/goblinJson", "spine/goblin/goblinAtlas");
        goblin = new GSpineSprite("goblin");
        Futile.stage.AddChild(goblin);
        goblin.SetSkin("goblin");
        goblin.Play("walk");
        goblin.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        goblin.isVisible = false;

        // load the spineboy sprite
        GSpineManager.LoadSpine("spineboy", "spine/spineboy/spineboyJson", "spine/spineboy/spineboyAtlas");
        spineboy = new GSpineSprite("spineboy");
        Futile.stage.AddChild(spineboy);
        spineboy.SetAnimationMix("jump", "walk", 0.4f);
        spineboy.Play("walk");
        spineboy.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        spineboy.isVisible = false;
    }
コード例 #2
0
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);

        fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);
        Futile.instance.Init(fparams);


        GSpineManager.LoadSpine("powerup", "spine/powerup/powerup-spine", "spine/powerup/powerup-atlas");
        sprite = new GSpineSprite("powerup");
        Futile.stage.AddChild(sprite);
        sprite.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        sprite.Play("animation");
    }
コード例 #3
0
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);

        fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);
        Futile.instance.Init(fparams);


        GSpineManager.LoadSpine("spineboy-original", "spine/spineboy-original/spineboy-original-spine", "spine/spineboy-original/spineboy-original-atlas");
        sprite = new GSpineSprite("spineboy-original");
        Futile.stage.AddChild(sprite);
        sprite.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        sprite.Play("walk");
        sprite.SetAnimationMix("jump", "walk", 0.4f);
    }
コード例 #4
0
    void OnGUI()
    {
        GUI.skin.button.fixedWidth = 200;
        GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height));
        _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height));


        if (GUILayout.Button("Goblins Example"))
        {
            Application.LoadLevel("GoblinsExample");
        }
        if (GUILayout.Button("Powerup Example"))
        {
            Application.LoadLevel("PowerupExample");
        }
        if (GUILayout.Button("Spineboy Original Example"))
        {
            Application.LoadLevel("SpineboyOriginalExample");
        }
        if (GUILayout.Button("Spineboy Spaceman Example"))
        {
            Application.LoadLevel("SpineboySpacemanExample");
        }


        if (GUILayout.Button("Play Animation"))
        {
            sprite.Play("animation");
        }
        if (GUILayout.Button("Pause Animation"))
        {
            sprite.Pause();
        }
        if (GUILayout.Button("Resume Animation"))
        {
            sprite.Resume();
        }
        if (GUILayout.Button("Stop Animation"))
        {
            sprite.Stop();
        }


        if (GUILayout.Button("Slow Motion"))
        {
            sprite.SetAnimationTimeScale(0.5f);
        }
        if (GUILayout.Button("Normal Speed"))
        {
            sprite.SetAnimationTimeScale(1.0f);
        }


        if (GUILayout.Button("Tint Wings Red"))
        {
            sprite.FindSlotByName("left wing").color  = Color.red;
            sprite.FindSlotByName("right wing").color = Color.red;
        }
        if (GUILayout.Button("Tint Entire Sprite Blue"))
        {
            sprite.color = Color.blue;
        }
        if (GUILayout.Button("Clear Tint"))
        {
            sprite.color = Color.white;
        }


        if (GUILayout.Button("Scale sprite 2x"))
        {
            sprite.scale = 2.0f;
        }
        if (GUILayout.Button("Scale sprite 0.5x"))
        {
            sprite.scale = 0.5f;
        }
        if (GUILayout.Button("Reset Scale"))
        {
            sprite.scale = 1.0f;
        }


        if (GUILayout.Button("Rotate sprite 45deg"))
        {
            sprite.rotation -= 45.0f;
        }
        if (GUILayout.Button("Reset rotation"))
        {
            sprite.rotation = 0.0f;
        }


        if (GUILayout.Button("Flip X"))
        {
            sprite.flipX = !sprite.flipX;
        }
        if (GUILayout.Button("Flip Y"))
        {
            sprite.flipY = !sprite.flipY;
        }


        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
コード例 #5
0
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);
        fparams.AddResolutionLevel(1024.0f,	1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f,0.5f);
        Futile.instance.Init(fparams);

        GSpineManager.LoadSpine("spineboy-spaceman", "spine/spineboy-spaceman/spineboy-spaceman-spine", "spine/spineboy-spaceman/spineboy-spaceman-atlas");
        sprite = new GSpineSprite("spineboy-spaceman");
        Futile.stage.AddChild(sprite);
        sprite.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        sprite.scale = 0.5f;
        sprite.Play("idle");
        sprite.SetAnimationMix("jump", "idle", 0.4f);
        sprite.SetAnimationMix("hit", "idle", 0.4f);
        sprite.SetAnimationMix("shoot", "idle", 0.4f);
    }
コード例 #6
0
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);
        fparams.AddResolutionLevel(1024.0f,	1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f,0.5f);
        Futile.instance.Init(fparams);

        // Load the powerup sprite
        GSpineManager.LoadSpine("powerup", "spine/powerup/powerupJson", "spine/powerup/powerupAtlas");
        powerup = new GSpineSprite("powerup");
        Futile.stage.AddChild(powerup);
        powerup.Play("animation");
        powerup.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        _activeSprite = powerup;

        // load the goblin sprite
        GSpineManager.LoadSpine("goblin", "spine/goblin/goblinJson", "spine/goblin/goblinAtlas");
        goblin = new GSpineSprite("goblin");
        Futile.stage.AddChild(goblin);
        goblin.SetSkin("goblin");
        goblin.Play("walk");
        goblin.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        goblin.isVisible = false;

        // load the spineboy sprite
        GSpineManager.LoadSpine("spineboy", "spine/spineboy/spineboyJson", "spine/spineboy/spineboyAtlas");
        spineboy = new GSpineSprite("spineboy");
        Futile.stage.AddChild(spineboy);
        spineboy.SetAnimationMix("jump", "walk", 0.4f);
        spineboy.Play("walk");
        spineboy.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        spineboy.isVisible = false;
    }
コード例 #7
0
    void Start()
    {
        // Setup Futile
        FutileParams fparams = new FutileParams(true, true, true, true);
        fparams.AddResolutionLevel(1024.0f,	1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f,0.5f);
        Futile.instance.Init(fparams);

        GSpineManager.LoadSpine("powerup", "spine/powerup/powerup-spine", "spine/powerup/powerup-atlas");
        sprite = new GSpineSprite("powerup");
        Futile.stage.AddChild(sprite);
        sprite.SetPosition((Futile.screen.halfWidth * 0.25f), -(Futile.screen.halfHeight * 0.5f));
        sprite.Play("animation");
    }
コード例 #8
0
ファイル: Example.cs プロジェクト: rvdveen/Futile-SpineSprite
    void OnGUI()
    {
        GUI.skin.button.fixedWidth = 200;
        GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height));
        _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height));


        // display the poweup sprite
        if (GUILayout.Button("Show Powerup Sprite"))
        {
            _activeSprite.isVisible = false;
            _activeSprite           = powerup;
            _activeSprite.isVisible = true;
        }

        // display the goblin sprite
        if (GUILayout.Button("Show Goblin Sprite"))
        {
            _activeSprite.isVisible = false;
            _activeSprite           = goblin;
            _activeSprite.isVisible = true;
        }

        // display spineboy sprite
        if (GUILayout.Button("Show Spineboy Sprite"))
        {
            _activeSprite.isVisible = false;
            _activeSprite           = spineboy;
            _activeSprite.isVisible = true;
        }

        // play the default animation for the active sprite
        if (GUILayout.Button("Play Animation"))
        {
            if (_activeSprite == powerup)
            {
                powerup.Play("animation");
            }
            else if (_activeSprite == goblin)
            {
                goblin.Play("walk");
            }
            else if (_activeSprite == spineboy)
            {
                spineboy.Play("walk");
            }
        }

        // pause the animation
        if (GUILayout.Button("Pause Animation"))
        {
            _activeSprite.Pause();
        }

        // resume it
        if (GUILayout.Button("Resume Animation"))
        {
            _activeSprite.Resume();
        }

        // stop the animation and reset the pose
        if (GUILayout.Button("Stop Animation"))
        {
            _activeSprite.Stop();
        }

        // adjusts the play speed
        if (GUILayout.Button("Slow Motion"))
        {
            _activeSprite.SetAnimationTimeScale(0.5f);
        }

        // resets the play speed
        if (GUILayout.Button("Normal Speed"))
        {
            _activeSprite.SetAnimationTimeScale(1.0f);
        }

        // color the entire spine blue
        if (GUILayout.Button("Color Sprite Blue"))
        {
            _activeSprite.color = Color.blue;
        }

        // reset the color
        if (GUILayout.Button("Clear Sprite Color"))
        {
            _activeSprite.color = Color.white;
        }

        // color the powerup wings
        if (GUILayout.Button("Powerup - Color Wings Red"))
        {
            powerup.FindSlotByName("left wing").color  = Color.red;
            powerup.FindSlotByName("right wing").color = Color.red;
        }

        // changes the skins on the goblin
        if (GUILayout.Button("Goblin - Set Skin (Goblin)"))
        {
            goblin.SetSkin("goblin");
        }
        if (GUILayout.Button("Goblin - Set Skin (GoblinGirl)"))
        {
            goblin.SetSkin("goblingirl");
        }

        // spineboy jumps once and stops
        if (GUILayout.Button("Spineboy - Jump Once"))
        {
            spineboy.Play("jump", false);
        }

        // spineboy jumps in a loop
        if (GUILayout.Button("Spineboy - Jump Forever"))
        {
            spineboy.Play("jump", true);
        }

        // spineboy jumps and then queues walk to start and loop when jumping is finished
        if (GUILayout.Button("Spineboy - Jump & Walk"))
        {
            spineboy.Play("jump", false);
            spineboy.Queue("walk", true);
        }


        // sets the sprite scale 2x
        if (GUILayout.Button("Scale sprite 2x"))
        {
            _activeSprite.scale = 2.0f;
        }

        // sets the sprite scale .5x
        if (GUILayout.Button("Scale sprite 0.5x"))
        {
            _activeSprite.scale = 0.5f;
        }

        // resets the sprite scale
        if (GUILayout.Button("Reset Scale"))
        {
            _activeSprite.scale = 1.0f;
        }

        // rotate sprite 45
        if (GUILayout.Button("Rotate sprite 45deg"))
        {
            _activeSprite.rotation -= 45.0f;
        }

        // reset sprite rotation
        if (GUILayout.Button("Reset rotation"))
        {
            _activeSprite.rotation = 0.0f;
        }


        // flip horizontally
        if (GUILayout.Button("Flip X"))
        {
            _activeSprite.flipX = !_activeSprite.flipX;
        }
        // flip vertically
        if (GUILayout.Button("Flip Y"))
        {
            _activeSprite.flipY = !_activeSprite.flipY;
        }


        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
コード例 #9
0
    void OnGUI()
    {
        GUI.skin.button.fixedWidth = 200;
        GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height));
        _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height));


        if (GUILayout.Button("Goblins Example"))
        {
            Application.LoadLevel("GoblinsExample");
        }
        if (GUILayout.Button("Powerup Example"))
        {
            Application.LoadLevel("PowerupExample");
        }
        if (GUILayout.Button("Spineboy Original Example"))
        {
            Application.LoadLevel("SpineboyOriginalExample");
        }
        if (GUILayout.Button("Spineboy Spaceman Example"))
        {
            Application.LoadLevel("SpineboySpacemanExample");
        }


        if (GUILayout.Button("Play Animation"))
        {
            sprite.Play("walk");
        }
        if (GUILayout.Button("Pause Animation"))
        {
            sprite.Pause();
        }
        if (GUILayout.Button("Resume Animation"))
        {
            sprite.Resume();
        }
        if (GUILayout.Button("Stop Animation"))
        {
            sprite.Stop();
        }


        if (GUILayout.Button("Slow Motion"))
        {
            sprite.SetAnimationTimeScale(0.5f);
        }
        if (GUILayout.Button("Normal Speed"))
        {
            sprite.SetAnimationTimeScale(1.0f);
        }


        if (GUILayout.Button("Idle Animation"))
        {
            sprite.Play("idle", true);
        }
        if (GUILayout.Button("Walk Animation"))
        {
            sprite.Play("walk", true);
        }
        if (GUILayout.Button("Run Animation"))
        {
            sprite.Play("run", true);
        }
        if (GUILayout.Button("Jump Animation"))
        {
            sprite.Play("jump", false);
            sprite.Queue("idle");
        }
        if (GUILayout.Button("Hit Animation"))
        {
            sprite.Play("hit", false);
            sprite.Queue("idle");
        }
        if (GUILayout.Button("Shoot Animation"))
        {
            sprite.Play("shoot", false);
            sprite.Queue("idle");
        }
        if (GUILayout.Button("Death Animation"))
        {
            sprite.Play("death", false);
        }


        if (GUILayout.Button("Tint Blue"))
        {
            sprite.color = Color.blue;
        }
        if (GUILayout.Button("Clear Tint"))
        {
            sprite.color = Color.white;
        }


        if (GUILayout.Button("Scale sprite 2x"))
        {
            sprite.scale = 2.0f;
        }
        if (GUILayout.Button("Scale sprite 0.5x"))
        {
            sprite.scale = 0.5f;
        }
        if (GUILayout.Button("Reset Scale"))
        {
            sprite.scale = 1.0f;
        }


        if (GUILayout.Button("Rotate sprite 45deg"))
        {
            sprite.rotation -= 45.0f;
        }
        if (GUILayout.Button("Reset rotation"))
        {
            sprite.rotation = 0.0f;
        }


        if (GUILayout.Button("Flip X"))
        {
            sprite.flipX = !sprite.flipX;
        }
        if (GUILayout.Button("Flip Y"))
        {
            sprite.flipY = !sprite.flipY;
        }


        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }