Exemple #1
0
    public void UpdateAnimation()
    {
        float timeDiff = Time.time - aniStartTime;

        if (timeDiff < 15.0f)
        {
            float dayTimeDiff = ((0.5f - timeDiff) > 0) ? (0.5f - timeDiff) : 0;
            dayImg.Rect = new Rect(Day.x + AutoRect.AutoX(2000 * dayTimeDiff), Day.y, Day.width, Day.height);
            if (dayTimeDiff == 0)
            {
                float scaleTime = timeDiff - 0.5f;
                if (scaleTime >= 0 && scaleTime <= 0.1f)
                {
                    dayImg.SetTextureSize(new Vector2(ButtonsTexturePosition.Day.width * (1 + scaleTime * 5), ButtonsTexturePosition.Day.height * (1 + scaleTime * 5)));
                }
                else if (scaleTime > 0.1f && scaleTime <= 0.2f)
                {
                    dayImg.SetTextureSize(new Vector2(ButtonsTexturePosition.Day.width * (2f - scaleTime * 5), ButtonsTexturePosition.Day.height * (2f - scaleTime * 5)));
                }
            }


            for (int i = 0; i < 3; i++)
            {
                float numTimeDiff = ((0.5f + (i + 1) * 0.5f - timeDiff) > 0) ? (0.5f + (i + 1) * 0.5f - timeDiff) : 0;
                Rect  r           = GetNumberPos(i);
                numberImg[i].Rect = new Rect(r.x + AutoRect.AutoX(2000 * numTimeDiff), r.y, r.width, r.height);

                if (numTimeDiff == 0)
                {
                    float scaleTime = timeDiff - (0.5f + (i + 1) * 0.5f);
                    Rect  texSize   = GameUITexturePosition.GetNumberRect(0);
                    if (scaleTime >= 0 && scaleTime <= 0.1f)
                    {
                        numberImg[i].SetTextureSize(new Vector2(texSize.width * (1 + scaleTime * 5), texSize.height * (1 + scaleTime * 5)));
                    }
                    else if (scaleTime > 0.1f && scaleTime <= 0.2f)
                    {
                        numberImg[i].SetTextureSize(new Vector2(texSize.width * (2f - scaleTime * 5), texSize.height * (2f - scaleTime * 5)));
                    }
                }
            }

            if (timeDiff > 4.0f)
            {
                dayImg.Rect = new Rect(Day.x - AutoRect.AutoX(2000 * (timeDiff - 4.0f)), Day.y, Day.width, Day.height);
                for (int i = 0; i < 3; i++)
                {
                    Rect r = GetNumberPos(i);
                    numberImg[i].Rect = new Rect(r.x - AutoRect.AutoX(2000 * (timeDiff - 4.0f)), r.y, r.width, r.height);
                }
            }
        }
    }
Exemple #2
0
        public void Init()
        {
            thumbCenter.x = AutoRect.AutoX(110);
            thumbCenter.y = AutoRect.AutoY(530);
            thumbRadius   = AutoRect.AutoValue(85);


            shootThumbCenter.x = AutoRect.AutoX(852);
            shootThumbCenter.y = AutoRect.AutoY(530);

            if (AutoRect.GetPlatform() == Platform.IPad)
            {
                thumbCenter.x      = AutoRect.AutoX(66);
                shootThumbCenter.x = AutoRect.AutoX(896);
                thumbCenter.y      = AutoRect.AutoY(500);
                shootThumbCenter.y = AutoRect.AutoY(500);
            }



            thumbCenterToScreen      = new Vector2(thumbCenter.x, Screen.height - thumbCenter.y);
            shootThumbCenterToScreen = new Vector2(shootThumbCenter.x, Screen.height - shootThumbCenter.y);

            lastShootTouch = shootThumbCenterToScreen;
            for (int i = 0; i < 2; i++)
            {
                lastTouch[i] = new Touch();
            }

            gameScene = GameApp.GetInstance().GetGameScene();
            player    = gameScene.GetPlayer();

            EnableMoveInput     = true;
            EnableShootingInput = true;
            EnableTurningAround = true;
        }