Beispiel #1
0
        IEnumerator DoLoop()
        {
            while (true)
            {
                ShakeConfig config     = configs [_curIndex];
                float       shakedTime = 0;
                while (true && shakedTime < config.time)
                {
                    Vector3 _position = transform.position;
                    if (!_pausing)
                    {
                        float m = config.scope * UnityEngine.Random.Range(-1f, 1f);
                        Vector2DUtils.ChangePosition(transform, _position.x + m, _position.y + m, _position.z);

                        shakedTime += Time.deltaTime;
                    }
//					Log.Debug (" 1111 ... {0}",gameObject.name);

                    yield return(new WaitForSeconds(config.interval));
                }
//				Log.Debug (" 2222 ... {0}",gameObject.name);
                _curIndex = (_curIndex + 1) % configs.Count;

                yield return(new WaitForSeconds(interval));
            }
        }