Пример #1
0
    void LateUpdate()
    {
        if (Vector2.Distance(playerShip.transform.position, transform.position) < 5f && playerShip.GetComponent <PlayerScript>().enemiesDefeated == true && animator.enabled == false)
        {
            if (gambleDisplay.activeSelf == false)
            {
                if (spawnedIndicator == null)
                {
                    spawnedIndicator = Instantiate(examineIndicator, transform.position + new Vector3(0, 1f, 0), Quaternion.identity);
                    spawnedIndicator.GetComponent <ExamineIndicator>().parentObject = this.gameObject;
                }
            }
            else
            {
                if (spawnedIndicator != null)
                {
                    Destroy(spawnedIndicator);
                }
            }

            if (menuSlideAnimation.IsAnimating == false)
            {
                if (gambleDisplay.activeSelf == true)
                {
                    if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.E))
                    {
                        menuSlideAnimation.PlayEndingAnimation(gambleDisplay, () => { gambleDisplay.SetActive(false); });
                        playerShip.GetComponent <PlayerScript>().removeRootingObject();
                        Time.timeScale = 1;
                        playerShip.GetComponent <PlayerScript>().windowAlreadyOpen = false;
                    }
                }
                else if (playerShip.GetComponent <PlayerScript>().windowAlreadyOpen == false)
                {
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        gambleDisplay.SetActive(true);
                        menuSlideAnimation.PlayOpeningAnimation(gambleDisplay);
                        updateDisplay(targetItem);
                        playerShip.GetComponent <PlayerScript>().addRootingObject();
                        Time.timeScale = 0;
                        playerShip.GetComponent <PlayerScript>().windowAlreadyOpen = true;
                    }
                }
                else
                {
                    if (spawnedIndicator != null)
                    {
                        Destroy(spawnedIndicator);
                    }
                }
            }
        }
        else
        {
            if (spawnedIndicator != null)
            {
                Destroy(spawnedIndicator);
            }
        }
    }
Пример #2
0
    void LateUpdate()
    {
        if (Vector2.Distance(playerShip.transform.position, transform.position) < 5f && playerShip.GetComponent <PlayerScript>().enemiesDefeated == true)
        {
            if (shopDisplay.activeSelf == false)
            {
                if (spawnedIndicator == null)
                {
                    spawnedIndicator = Instantiate(examineIndicator, transform.position + new Vector3(0, 1f, 0), Quaternion.identity);
                    spawnedIndicator.GetComponent <ExamineIndicator>().parentObject = this.gameObject;
                }
            }
            else
            {
                if (spawnedIndicator != null)
                {
                    Destroy(spawnedIndicator);
                }
            }

            if (menuSlideAnimation.IsAnimating == false)
            {
                if (shopDisplay.activeSelf == true)
                {
                    if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.I))
                    {
                        menuSlideAnimation.PlayEndingAnimation(shopDisplay, () => { shopDisplay.SetActive(false); playerShip.GetComponent <PlayerScript>().windowAlreadyOpen = false; });
                        PlayerProperties.playerInventory.PlayInventoryExitAnimation();
                        playerShip.GetComponent <PlayerScript>().removeRootingObject();
                        Time.timeScale = 1;
                    }
                }
                else
                {
                    if (playerShip.GetComponent <PlayerScript>().windowAlreadyOpen == false)
                    {
                        if (Input.GetKeyDown(KeyCode.E))
                        {
                            shopDisplay.SetActive(true);
                            menuSlideAnimation.PlayOpeningAnimation(shopDisplay);
                            PlayerProperties.playerInventory.PlayInventoryEnterAnimation();
                            inventoryDisplay.SetActive(true);
                            playerShip.GetComponent <Inventory>().UpdateUI();
                            playerShip.GetComponent <PlayerScript>().addRootingObject();
                            setShopDisplay();
                            playerShip.GetComponent <PlayerScript>().windowAlreadyOpen = true;
                        }
                    }
                    else
                    {
                        if (spawnedIndicator != null)
                        {
                            Destroy(spawnedIndicator);
                        }
                    }
                }
            }
        }
        else
        {
            if (spawnedIndicator != null)
            {
                Destroy(spawnedIndicator);
            }
        }
    }