Hey, I’m currently trying to work with the Smooth Moves 2d addon for Unity. Which is entirely in C#. There is an example in their faq page which I was hoping I could get translated into UnityScript. I’ve tried giving it a shot, but I’m getting errors.
Here’s the code;
public SmoothMoves.Sprite sprite;
public SmoothMoves.TextureAtlas atlas1;
public SmoothMoves.TextureAtlas atlas2;
void Update ()
{
// swap to the first atlas
if (Input.GetKeyDown(KeyCode.Alpha1))
{
sprite.SetAtlas(atlas1);
sprite.SetTextureName("Head");
}
// swap to the second atlas
if (Input.GetKeyDown(KeyCode.Alpha2))
{
sprite.SetAtlas(atlas2);
sprite.SetTextureName("Head");
}
// change to the "Head" texture
if (Input.GetKeyDown(KeyCode.H))
{
sprite.SetTextureName("Head");
}
// change to the "Body" texture
if (Input.GetKeyDown(KeyCode.B))
{
sprite.SetTextureName("Body");
}
// set the color to a red with half alpha strength
if (Input.GetKeyDown(KeyCode.C))
{
sprite.SetColor(new Color(1.0f, 0, 0, 0.5f));
}
// set the color to white
if (Input.GetKeyDown(KeyCode.X))
{
sprite.SetColor(Color.white);
}
}
Thanks