playMaker

Author Topic: HOTween.To never starts in OnEnter  (Read 1413 times)

Bradamante3D

  • Playmaker Newbie
  • *
  • Posts: 3
HOTween.To never starts in OnEnter
« on: September 12, 2014, 06:54:34 PM »
Hi,

in my space game I have space ships that drift a bit when they get disabled after being fired upon. So, I got something like this in the Disabled state:

Code: [Select]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

using Holoville.HOTween;

namespace HutongGames.PlayMaker.Actions {

public class PMADrifting : FsmStateAction {

private Transform tf;

public bool everyFrame;

public override void Awake () {

tf = Owner.transform;
}

public override void Reset () {

}

public override void OnEnter () {

Vector3 targetPos = tf.position + mc.currentVel * 4f;

HOTween.To ( tf, 4f, new TweenParms()
            .Id( string.Format( "TweenShip{0}", dc.id ) )
            .Prop ( "position", targetPos )
            .Ease ( EaseType.EaseOutSine )
            .Loops(1, LoopType.Yoyo)
            .OnComplete ( OnFinish )
            );
}

private void OnFinish () { }
}
}

Only the important parts. OnFinish is empty, so that's not it ("don't use Finish directly").

Looks to me like HOTween.To is never called or whatever. I can however build a Sequence of Tweens in OnEnter and use Sequence.Play(). That I have in other Actions and it works.

What am I doing wrong?