Пример #1
0
 public void ResetDamage()
 {
     damage                = 0;
     glass.sprite          = glassStages[0];
     idle                  = true;
     currentAnimationStage = null;
 }
Пример #2
0
        private async void AnimateIn()
        {
            if (CurrentAnimState != AnimationStage.Out)
            {
                return;
            }

            CurrentAnimState = AnimationStage.In;

            await AnimateUI(m_logoY, m_buttonScale, m_backgroundAlpha, Easing.SinOut);
        }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (idle && Time.time > nextFrame)
        {
            if (currentAnimationStage == null)
            {
                currentAnimationStage = idleAnimationStages[0];
                character.sprite      = idlePortraits[0];
            }
            else
            {
                currentAnimationStage = idleAnimationStages[currentAnimationStage.nextIndex];
                character.sprite      = idlePortraits[currentAnimationStage.imageIndex];
            }
            nextFrame = Time.time + currentAnimationStage.time;
        }

        if (!finishedSliding)
        {
            if (slidingIn)
            {
                float   percent = slideInCurve.Evaluate((Time.time - startTime) / slideInTime);
                Vector2 newPos  = startPos + ((endPos - startPos) * percent); //lerp is capped at 1
                container.anchoredPosition = newPos;                          //Vector2.Lerp(startPos, endPos, percent);

                if (percent == 1)
                {
                    gameObject.GetComponent <GameObjectShake>().enabled = true;
                    finishedSliding = true;
                }
            }
            else
            {
                float percent = slideOutCurve.Evaluate((Time.time - startTime) / slideOutTime);
                container.anchoredPosition = Vector2.Lerp(endPos, startPos, percent);

                if (percent == 1)
                {
                    finishedSliding = true;
                    transform.parent.gameObject.SetActive(false);
                }
            }
        }
    }
Пример #4
0
        private async void AnimateOut()
        {
            if (CurrentAnimState == AnimationStage.Out)
            {
                return;
            }

            CurrentAnimState = AnimationStage.Out;

            //Bounce out the UI
            await AnimateUI(m_logoOffY, m_buttonOffScale, m_backgroundOffAlpha, Easing.SinIn);

            var vm = BindingContext as MainViewModel;

            if (vm != null)
            {
                vm.OnNewGameStart();
            }
        }
Пример #5
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            //Store off the UI positions we want to animate
            m_logoY           = Logo.Y;
            m_buttonScale     = NewGameButton.Scale;
            m_backgroundAlpha = 1;

            m_logoOffY           = -Logo.Height;
            m_buttonOffScale     = 0;
            m_backgroundOffAlpha = 0;

            //Animate in
            if (CurrentAnimState == AnimationStage.None)
            {
                //Move to Off animation and animate On
                Logo.TranslationY   = m_logoOffY - Logo.Y;
                NewGameButton.Scale = 0;

                CurrentAnimState = AnimationStage.Out;
                AnimateIn();
            }
        }
Пример #6
0
        public MainView()
        {
            InitializeComponent();

            CurrentAnimState = AnimationStage.None;
        }