public void doAction(TriggerSignalObject trigger) { Sequence sequence = DOTween.Sequence (); isTriggered = true; for(int i = 0; i < wayPoints.Count; i++) { sequence.Append(transform.DOMove(wayPoints[i].transform.position, wayPointSpeeds[i])); sequence.Join(transform.DORotate (wayPoints[i].transform.eulerAngles, wayPointSpeeds[i])); } sequence.PrependInterval (startDelay); sequence.AppendInterval (endDelay); if (loop) { for(int i = wayPoints.Count - 2; i >= 0; i--) { sequence.Append(transform.DOMove(wayPoints[i].transform.position, wayPointSpeeds[i + 1])); sequence.Join(transform.DORotate (wayPoints[i].transform.eulerAngles, wayPointSpeeds[i + 1])); } sequence.Append(transform.DOMove(startingLocation, wayPointSpeeds[0])); sequence.Join(transform.DORotate (startingRotation, wayPointSpeeds[0])); } sequence.OnComplete (() => {trigger.objectFinished (this);}); sequence.Play (); }
public void doAction(TriggerSignalObject trigger) { Sequence sequence = DOTween.Sequence(); isTriggered = true; for (int i = 0; i < wayPoints.Count; i++) { sequence.Append(transform.DOMove(wayPoints[i].transform.position, wayPointSpeeds[i])); sequence.Join(transform.DORotate(wayPoints[i].transform.eulerAngles, wayPointSpeeds[i])); } sequence.PrependInterval(startDelay); sequence.AppendInterval(endDelay); if (loop) { for (int i = wayPoints.Count - 2; i >= 0; i--) { sequence.Append(transform.DOMove(wayPoints[i].transform.position, wayPointSpeeds[i + 1])); sequence.Join(transform.DORotate(wayPoints[i].transform.eulerAngles, wayPointSpeeds[i + 1])); } sequence.Append(transform.DOMove(startingLocation, wayPointSpeeds[0])); sequence.Join(transform.DORotate(startingRotation, wayPointSpeeds[0])); } sequence.OnComplete(() => { trigger.objectFinished(this); }); sequence.Play(); }
public void doAction(TriggerSignalObject trigger) { Debug.Log(loop); if (!isTriggered || loop) { Debug.Log("Go again..."); on = !on; switchOnOff(on); isTriggered = true; trigger.objectFinished(this); } }
public void doAction(TriggerSignalObject trigger) { Debug.Log (loop); if(!isTriggered || loop) { Debug.Log ("Go again..."); on = !on; switchOnOff (on); isTriggered = true; trigger.objectFinished (this); } }