Actions like in cocos2d, which approach to take

Hi all,

I’m new to Unity, am currently on a experimentation phase to discover if is the right tool for me.
Interested in mainly mobile game multi-platform development, and for a single developer doing this has a hobby 1400$ is still a lot to ask :slight_smile:

I wonder if there’s anything similar to Cocos2D Actions http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions

Noticed that there are loads of add-ons out there, but most of them are apparently paid. iTween is an exception, but maybe a bit overkill to my needs.

I created a simple script with this kind of functionality, and it seems to work well. However would like here comments if this a good approach/flaws/etc if possible :slight_smile:

To use it, subclass your object from Actor instead of MonoBehaviour:

public class Test : Actor {

And then add actions, either single, sequence or parallel mode:

	// Initialization
	void Start () {
		
		// Add single actions (run in sequence)
		AddAction(new ScaleTo(new Vector3(1.1f, 1.1f, 1f), 0.25f));
		
		// Add sequence of actions (run in sequence)
		AddAction(new Sequence(
					new ScaleTo(new Vector3(2f, 2f, 1f), 1f),
					new RotateTo(new Vector3(0f, 0f, 90f), 1f),
					new MoveTo(new Vector3(1f, 1f, 0f), 2f)
				));
		
		// Add parallel	actions (run at same time)
		AddAction(new Parallel(
					new FadeTo(1.0f, 2f),
					new ScaleTo(new Vector3(2f, 2f, 1f), 1f),
					new RotateTo(new Vector3(0f, 0f, 90f), 1f),
					new MoveTo(new Vector3(1f, 1f, 0f), 2f)
				));

	}

1088618–40841–$Actor.zip (5.82 KB)

1 Like

I think I’ve misjudged iTween, been experimenting with it more thoroughly for a couple of days.
And my conclusion is that is perfect for my needs, actually very similar to cocos2d actions, allowing callbacks and everything.

No need to reinvent the wheel :slight_smile: