Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: msc4tech on December 06, 2011, 05:16:16 AM
-
this code change sprite by name
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("2D Toolkit")]
[Tooltip("set sprite by name of tk2dSprite")]
public class Set2DToolkitSpriteByName : FsmStateAction {
[RequiredField]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmString spriteName;
private GameObject go;
private tk2dSprite sprite;
public override void Reset() {
gameObject = null;
spriteName = null;
}
public override void OnEnter() {
go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;
sprite = go.GetComponent<tk2dSprite>();
sprite.spriteId=sprite.GetSpriteIdByName(spriteName.Value);
Finish();
}
}
}
-
Hi Everyone,
I have started porting 2d toolkit and currently gathering custom actions. The package will be available very soon :)
Meanwhile, if you have wishes or requests for 2d toolkit and playmaker, this is the right time to ask for it :)
Thanks for ms4Tech for the head start on them actions.
https://hutonggames.fogbugz.com/default.asp?W717 (https://hutonggames.fogbugz.com/default.asp?W717)
Bye,
Jean
-
I know I'm bumping the dead here, but why is this not in the wiki package? It still works flawlessly
-
Hi,
Thanks for reminding me. I haven't give yet a second rundown to it to include the various custom actions created since.
Can you bump again like mid november? I should have more time to allocate to this and update the wiki package with all the latest additions
bye,
Jean
-
How did i switch a sprite image on a different sprite collection?
-
Hi,
Uhm, I tried to look at this, but I can't find any convenient api to do that at runtime, the utilities seems to only exists in editors.
I can of cours elet you pick a library by index ( 0, 1, 2 etc), but that's not really convenient...
I have asked this to the 2dtoolkit guy, I'll see what is coming up from it.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1152.0.html
bye,
Jean