Пример #1
0
    private void LateUpdate()
    {
        PlayerEntity currentPlayer = GameManager.Instance.GetPlayer();

        // For displaying lookup
        // If facing down
        if ((GameManager.Instance.GetCurrentState() == GameManager.GameState.FreeRoam || GameManager.Instance.GetCurrentState() == GameManager.GameState.MatchStarsMode) &&
            (Vector3.Dot(currentPlayer.transform.forward, Vector3.down) > 0.3))
        {
            // if time to change visibility
            if (_currentLookUpBlinkTime <= 0)
            {
                // Adjust blinks based upon active or inactive
                if (lookUpPanel.activeSelf)
                {
                    lookUpPanel.SetActive(false);
                    _currentLookUpBlinkTime = lookUpBlinkDelay * lookUpBlinkPortionUnvisible;
                }
                else
                {
                    lookUpPanel.SetActive(true);
                    _currentLookUpBlinkTime = lookUpBlinkDelay;
                }
            }
            _currentLookUpBlinkTime -= Time.deltaTime;
        }
        // If facing up
        else
        {
            if (lookUpPanel.activeSelf)
            {
                lookUpPanel.SetActive(false);
            }
        }



        // For displaying constellation screen
        if (constellationMatchItemId >= 0 && constellationMatchScreenPanel.activeInHierarchy)
        {
            constellationMatchScreenPanel.transform.rotation = Quaternion.LookRotation(currentPlayer.transform.forward, currentPlayer.transform.up);

            MusicManager.Instance.UpdateFindingDistanceMusic(ConstellationMatch, constellationMatchScreenPanel);
            if (ConstellationManager.IsMatchConstellation(ConstellationMatch, constellationMatchScreenPanel))
            {
                if (ConstellationManager.Instance.constellationItemList[constellationMatchItemId].displayInMap.GetComponent <ConstellationDisplayItem>().hasAnimation)
                {
                    ConstellationManager.Instance.constellationItemList[constellationMatchItemId].displayInMap.GetComponent <ConstellationDisplayItem>().isAnimated = true;
                    if (ConstellationManager.Instance.constellationItemList[constellationMatchItemId].displayInMap.GetComponent <ConstellationDisplayItem>().isCongratulation)
                    {
                        matchConstellation();
                    }
                }
                else
                {
                    matchConstellation();
                }
            }
            else
            {
                ConstellationManager.Instance.constellationItemList[constellationMatchItemId].displayInMap.GetComponent <ConstellationDisplayItem>().isAnimated = false;
            }
        }
    }