Exemple #1
0
        public void StartMove(float height, float speed, float scale)
        {
            InitSelf();

            pausing     = false;
            this.height = height;
            this.speed  = speed;
            this.scale  = scale;
            if (null != _cor)
            {
                StopCoroutine(_cor);
                _cor = null;
            }
            running = true;
            transform.localScale = new Vector3(scale, scale, 1);
            Vector2[] scope   = Vector2DUtils.GetScreenScope();
            float     xbound  = render.bounds.size.x * .5f;
            float     rightX  = scope [1].x + xbound;
            float     leftX   = scope [0].x - xbound;
            float     startX  = speed < 0?rightX:leftX;
            float     targetX = speed < 0?leftX:rightX;

            Vector2DUtils.ChangePositionX(transform, startX);
            gameObject.SetActive(true);
            _cor = StartCoroutine(DoUpdate(targetX));
        }
Exemple #2
0
        void EggRight()
        {
            Transform eggTrans = GameController.GetSingleton().levelsController.eggController.transform;

            Vector2DUtils.ChangePositionX(eggTrans, eggTrans.position.x + 1);
        }