Exemple #1
0
    void StartMover()
    {
        if (moving)
        {
            return;
        }
        moving = true;

        Vector3 f = GetPointAtPosition(path[pathPosition]);
        Vector3 t = GetPointAtPosition(path[pathPosition + 1]);

        pointPosition = path[pathPosition + 1];
        Vector3 next = pathPosition + 2 < path.Count - 1 ? GetPointAtPosition(path[pathPosition + 2]) : new Vector3(-1, -1, -1);

        rotator.InitMovement(f, t, next);

        pathPosition++;

        float speed    = 2f;
        float distance = Vector3.Distance(f, t);
        float time     = distance / speed;

        Co2.StartCoroutine(
            time,
            (float p) => { Move(p, f, t); },
            OnArriveAtPoint
            );
    }
Exemple #2
0
 public void Swell(float duration, bool repeat = false)
 {
     Co2.StartCoroutine(duration, (float p) => {
         Fill = Mathf.Sin(Mathf.PI * p);
     }, () => {
         if (repeat)
         {
             Swell(duration, true);
         }
     });
 }
Exemple #3
0
		public bool Start () {

			// Don't allow the action to overlap itself
			if (!Enabled || performing) return false;
			performing = true;
			perform = true;

			Log ("Start", true);
			OnStart ();
			Co2.StartCoroutine (Duration
			#if QUARTER_TIME
			*0.25f
			#else
			, SetProgress, End);
			#endif

			return true;
		}