Esempio n. 1
0
        void Run(object param)
        {
            float   r  = Mathf.Ceil(shakeAmplitude * elapsed / shakePeriod);
            Vector2 vr = UnityEngine.Random.insideUnitCircle * r;

            vr.x = vr.x > 0 ? Mathf.Ceil(vr.x) : Mathf.Floor(vr.x);
            vr.y = vr.y > 0 ? Mathf.Ceil(vr.y) : Mathf.Floor(vr.y);

            target._gearLocked = true;
            target.SetXY(target.x - offsetX + vr.x, target.y - offsetY + vr.y);
            target._gearLocked = false;

            offsetX  = vr.x;
            offsetY  = vr.y;
            elapsed -= Time.deltaTime;
            if (elapsed <= 0)
            {
                target._gearLocked = true;
                target.SetXY(target.x - offsetX, target.y - offsetY);
                target._gearLocked = false;

                Timers.inst.Remove(timerDelegate);

                owner.OnInnerActionComplete(this);
            }
        }
Esempio n. 2
0
        override public void Setup(Transition owner)
        {
            base.Setup(owner);

            playCompleteDelegate = () => { owner.OnInnerActionComplete(this); };
        }