Exemple #1
0
    public Hello3D()
    {
        CC3FbxGeneric hero = new CC3FbxGeneric("cocos2d-unity-demo/3D/Prefabs/Hero");

        hero.setUnityLayerRecursively("3D");
        hero.position3D = new Vector3(CCDirector.sharedDirector.winSize.x / 2, CCDirector.sharedDirector.winSize.y / 2 - 30, -700);
        hero.rotationY  = 180;
        addChild(hero);

        hero.eventHandler = delegate(AnimationEvent evt){
            if (evt.stringParameter == "End")
            {
                hero.playAnimation("Idle");
            }
        };

        var delay  = new CCDelayTime(3f);
        var attack = new CCCallBlock(delegate {
            hero.playAnimation("Punch");
        });
        var seq    = CCSequence.Actions(delay, attack);
        var repeat = new CCRepeatForever(seq as CCActionInterval);

        hero.runAction(repeat);
    }
Exemple #2
0
		public override void Play(MovieCallback callback){
			if (callback == null) {
				Play();
				return;
			}
			if (_startFrame == _endFrame) {
				GotoFrame(_startFrame);
				callback(this);	
				return;
			}
			Stop ();
			
			GotoFrame (_startFrame);
			MovieImpAction action = new MovieImpAction (this, _startFrame, _endFrame);
			CCActionFiniteTime callbackAction = new CCCallBlock (delegate {
				callback(this);			
			});
			CCActionInterval seq  = CCSequence.Actions (action, callbackAction) as CCActionInterval;
			if (_loop) {
				_action = new CCRepeatForever (seq);
			} else {
				_action = seq;
			}
			_view.runAction (_action);
		}