SetAnim() public method

public SetAnim ( Vector2 anim ) : void
anim Vector2
return void
コード例 #1
0
 // Use this for initialization
 void Start()
 {
     sprite = spriteManager.AddSprite(this.gameObject,2,2,new Vector2(.5f,.5f), new Vector2(.25f, .5f), new Vector3(0,0,0), true);
     stabbing = new UVAnimation();
     stabbing.name="stabbing";
     stabbing.SetAnim(stabbing.BuildUVAnim(new Vector2(.5f,.5f),new Vector2(.25f,.5f),2,2,3,2));
     stabbing.loopCycles=-1; // makes animation loop infinitely
     stabbing.loopReverse = true; // makes animation go in reverse after it's completed
     sprite.AddAnimation(stabbing);
     sprite.PlayAnim("stabbing");
 }
コード例 #2
0
    void InitSM()
    {
        S = LSM.AddSprite(this.gameObject, 5, 5, LSM.PixelCoordToUVCoord(0, 0), LSM.PixelSpaceToUVSpace(512, 512), -transform.forward * .4f, false);
        anim_run = new UVAnimation();
        anim_run.SetAnim(
            new Vector2[]{
                LSM.PixelCoordToUVCoord(3072, 0),
                LSM.PixelCoordToUVCoord(3072+512, 0),
                LSM.PixelCoordToUVCoord(0, 512),
                LSM.PixelCoordToUVCoord(512, 512),
                LSM.PixelCoordToUVCoord(1024, 512),
                LSM.PixelCoordToUVCoord(1024+512, 512),
                LSM.PixelCoordToUVCoord(2048, 512),
                LSM.PixelCoordToUVCoord(2048+512, 512)
            });
        //anim_run.BuildUVAnim(LSM.PixelCoordToUVCoord(3072, 512), LSM.PixelSpaceToUVSpace(512, 512), 16, 2, 16, 2f);
        anim_run.loopCycles = -1;
        //anim_run.PlayInReverse();
        anim_run.name = "Run";
        S.AddAnimation(anim_run);

        anim_idle = new UVAnimation();
        anim_idle.BuildUVAnim(LSM.PixelCoordToUVCoord(0, 512), LSM.PixelCoordToUVCoord(512, 512), 8, 2, 1, 12f);
        anim_idle.loopCycles = -1;
        S.AddAnimation(anim_idle);
        anim_idle.name = "Idle";

        anim_runstart = new UVAnimation();
        anim_runstart.BuildUVAnim(LSM.PixelCoordToUVCoord(0, 512), LSM.PixelCoordToUVCoord(512, 512), 8, 2, 1, 12f);
        anim_runstart.loopCycles = -1;
        S.AddAnimation(anim_runstart);
        anim_runstart.name = "RunStart";

        anim_current = "Run";
        S.PlayAnim(anim_run);
        LSM.ScheduleBoundsUpdate(0.5f);
    }