public void ResumeAnimationSynced(string animationName, bool useTimeOut = false)
    {
        Animation2D foundAnimation;

        animationsByName.TryGetValue(animationName, out foundAnimation);

        if (foundAnimation)
        {
            if (currentAnimation != foundAnimation)
            {
                int savedFrame = 0;
                if (currentAnimation)
                {
                    savedFrame = currentAnimation.GetPreviousFrame();
                    currentAnimation.Stop();
                    currentAnimation.Hide();
                }

                foundAnimation.SetCurrentFrame(savedFrame);
                foundAnimation.Show();
                foundAnimation.Play(false, false, useTimeOut);
            }
            currentAnimation = foundAnimation;
        }
    }
示例#2
0
 public void OnPlaySadAnimation()
 {
     happyAnimation.Stop();
     happyAnimation.Hide();
     sadAnimation.Show();
     sadAnimation.Play();
 }
示例#3
0
    public void OnPlaySadAnimation()
    {
        throwAnimation.Stop();
        throwAnimation.Hide();
        openDoorAnimation.Show();
        openDoorAnimation.Play();

        //clear otherwise pausing the game will break the game
        throwables.Clear();
    }
示例#4
0
 private void ContinueGame()
 {
     output.enabled = false;
     PauseHelper.ResumeGame();
     if (animationForCurrentRoomType)
     {
         animationForCurrentRoomType.Hide();
         animationForCurrentRoomType.Stop();
     }
 }
示例#5
0
    void Start()
    {
        fallEnemy = this.transform.Find("FallEnemy").GetComponent <FallEnemy>();

        if (this.transform.Find("FlickHand"))
        {
            flickHand = this.transform.Find("FlickHand").GetComponent <Animation2D>();
            flickHand.AddEventListener(this.gameObject);
            flickHand.Hide();
        }
    }
示例#6
0
    public void OnTextDone(TextBox textBox)
    {
        tapScreenAnimation.Show();
        tapScreenAnimation.Play();

        textBoxIsDone = true;
        Debug.Log("stopping animation?");
        lipsAnimation.Hide();
        lipsAnimation.Pause();

        DispatchMessage("OnTextPartDone", null);
    }
示例#7
0
    private void HideAnimationOfIcon(SpriteRenderer icon)
    {
        Animation2D iconAnimation = icon.GetComponent <Animation2D>();

        if (iconAnimation)
        {
            iconAnimation.Initialize();

            iconAnimation.Stop();
            iconAnimation.Hide();
        }
    }
    private void SwitchAnimation(Animation2D newAnimation, bool reset = true, bool play = true, bool reverse = false)
    {
        if (currentAdditiveAnimation)
        {
            currentAdditiveAnimation.Stop();
            currentAdditiveAnimation.Hide();
        }
        if (currentAnimation)
        {
            currentAnimation.Stop();
            currentAnimation.Hide();
        }

        currentAnimation = newAnimation;
        currentAnimation.Show();

        if (play)
        {
            currentAnimation.Play(reset, reverse);
        }
    }
示例#9
0
    public void OnPlayerGotAway()
    {
        canMove        = false;
        this.isEnabled = false;
        runAnimation.Stop();
        runAnimation.Hide();
        sadAnimation.Play();
        sadAnimation.Show();

        this.rigidbody2D.velocity    = new Vector2(0f, 0f);
        this.rigidbody2D.isKinematic = true;
        this.triggerCollider.enabled = false;
        this.normalCollider.enabled  = false;
        Invoke("OnDestroy", 5f);
    }
示例#10
0
    public void Hide()
    {
        contentToShow.active = false;

        animationToPlay.Hide();
        if (extraAnimationToPlay)
        {
            extraAnimationToPlay.Hide();
        }

        willHideAfterShowing = false;
        hideTimeout          = 0f;

        isHidden = true;
    }
    public void Hide()
    {
        if (this.onHideAnimation)
        {
            onShowAnimation.Hide();
            onShowAnimation.Stop();

            onHideAnimation.Show();
            onHideAnimation.Play(true);
        }
        else
        {
            this.active = false;
        }
    }
    protected virtual void OnActivated(int playerIndex)
    {
        foreach (TextBox textBox in textBoxes)
        {
            textBox.gameObject.SetActive(false);
            SoundUtils.SetSoundVolumeToSavedValueForGameObject(SoundType.FX, this.gameObject);
        }

        Transform onShowAnimationsTransform = this.transform.Find("Animations/OnShowAnimation");
        Transform onHideAnimationsTransform = this.transform.Find("Animations/OnHideAnimation");

        if (onShowAnimationsTransform && onHideAnimationsTransform)
        {
            onShowAnimation = this.transform.Find("Animations/OnShowAnimation").GetComponent <Animation2D>();
            onHideAnimation = this.transform.Find("Animations/OnHideAnimation").GetComponent <Animation2D>();

            onShowAnimation.AddEventListener(this.gameObject);
            onHideAnimation.AddEventListener(this.gameObject);

            onHideAnimation.Stop();
            onHideAnimation.Hide();

            onShowAnimation.Show();
            onShowAnimation.Awake();
            onShowAnimation.Play(true);

            isBusy = true;
        }
        else
        {
            ShowNextTextBalloon();
        }

        if (onShowSound)
        {
            SoundUtils.SetSoundVolumeToSavedValueForGameObject(SoundType.FX, this.gameObject);
            onShowSound.Play();
        }

        isActivated = true;
    }
    public void OnActivated()
    {
        foreach (TextBox textBox in textBoxes)
        {
            textBox.active = false;
            SoundUtils.SetSoundVolumeToSavedValue(SoundType.FX);
        }

        Transform onShowAnimationsTransform = this.transform.Find("Animations/OnShowAnimation");
        Transform onHideAnimationsTransform = this.transform.Find("Animations/OnHideAnimation");

        if (onShowAnimationsTransform && onHideAnimationsTransform)
        {
            onShowAnimation = this.transform.Find("Animations/OnShowAnimation").GetComponent <Animation2D>();
            onHideAnimation = this.transform.Find("Animations/OnHideAnimation").GetComponent <Animation2D>();

            onShowAnimation.AddEventListener(this.gameObject);
            onHideAnimation.AddEventListener(this.gameObject);

            onHideAnimation.Stop();
            onHideAnimation.Hide();

            onShowAnimation.Show();
            onShowAnimation.Awake();
            onShowAnimation.Play(true);

            isBusy = true;
        }
        else
        {
            ShowNextTextBalloon();
        }

        if (onShowSound)
        {
            SoundUtils.SetSoundVolumeToSavedValue(SoundType.FX);
            onShowSound.Play();
        }
    }
    public void Hide()
    {
        if (npcPictureNames)
        {
            npcPictureNames.gameObject.SetActive(false);
        }

        if (this.onHideAnimation)
        {
            onShowAnimation.Hide();
            onShowAnimation.Stop();

            onHideAnimation.AddEventListener(this.gameObject);

            onHideAnimation.Show();
            onHideAnimation.Play(true);
        }
        else
        {
            this.gameObject.SetActive(false);
        }
    }
示例#15
0
    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKey("space") || Input.GetMouseButtonDown(0)))
        {
            if (!spaceKeyDown && textBoxIsDone)
            {
                spaceKeyDown  = true;
                textBoxIsDone = false;
                tapScreenAnimation.Stop();
                tapScreenAnimation.Hide();
                ShowNextTextBalloon();
            }
        }

        if (spaceKeyDown)
        {
            if (!Input.GetKey("space"))
            {
                spaceKeyDown = false;
            }
        }
    }
示例#16
0
 public void OpenDoor()
 {
     normalAnimation.Stop();
     normalAnimation.Hide();
     openDoorAnimation.Show();
 }
示例#17
0
 public void OnTextDone()
 {
     talkingAnimation.Stop ();
     talkingAnimation.Hide ();
     isDoneTalking = true;
 }
示例#18
0
 public void OnAnimationDone(Animation2D animation2d)
 {
     flickHand.Hide();
 }