示例#1
0
            public bool IsValid(int i, int j)
            {
                if (!SceneTypeList.Contains(Grid[i, j]))
                {
                    return(true);
                }
                if (IsEntry(i, j) || IsExit(i, j))
                {
                    return(true);
                }

                if (TopFacing.Contains(Grid[i, j]))
                {
                    if ((i - 1) > 0)
                    {
                        if (!DownFacing.Contains(Grid[i - 1, j]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (RightFacing.Contains(Grid[i, j]))
                {
                    if ((j + 1) < GridSize)
                    {
                        if (!LeftFacing.Contains(Grid[i, j + 1]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (DownFacing.Contains(Grid[i, j]))
                {
                    if ((i + 1) < GridSize)
                    {
                        if (!TopFacing.Contains(Grid[i + 1, j]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (LeftFacing.Contains(Grid[i, j]))
                {
                    if ((j - 1) > 0)
                    {
                        if (!RightFacing.Contains(Grid[i, j - 1]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
示例#2
0
 private void Update()
 {
     if (PlayerMovementController.PMC.playerGameState == 0)
     {
         startLine = 0;
         endLine   = 15;
     }
     else if (PlayerMovementController.PMC.playerGameState == 1)
     {
         startLine = 17;
         endLine   = 32;
     }
     else if (PlayerMovementController.PMC.playerGameState == 2)
     {
         startLine = 34;
         endLine   = 50;
     }
     else if (PlayerMovementController.PMC.playerGameState == 3)
     {
         startLine = 52;
         endLine   = 67;
     }
     if (requireButtonPress && interactionPressed && !TextBubbleManager.TBM.textBubbleActive && playerInRange && PlayerMovementController.PMC.isGrounded)
     {
         if (PlayerMovementController.PMC.playerGameState == 0)
         {
             tiledLevels[0].SetActive(true);
         }
         else if (PlayerMovementController.PMC.playerGameState == 1)
         {
             tiledLevels[0].SetActive(false);
             tiledLevels[1].SetActive(true);
         }
         else if (PlayerMovementController.PMC.playerGameState == 2)
         {
             tiledLevels[1].SetActive(false);
             tiledLevels[2].SetActive(true);
         }
         else if (PlayerMovementController.PMC.playerGameState == 3)
         {
             tiledLevels[2].SetActive(false);
         }
         TextBubbleManager.TBM.ReloadScript(thisText);
         TextBubbleManager.TBM.currentLine = startLine;
         TextBubbleManager.TBM.lastLine    = endLine;
         CameraFollowScript.CFS.InteractedTargetPosition = gameObject;
         CameraFollowScript.CFS.isInteracted             = true;
         if (playerPosition.x < headPosition.position.x)
         {
             RectTransform rt = TextBubbleManager.TBM.TextBubble.GetComponent <RectTransform>();
             rt.localScale        = new Vector3(1, 1, 1);
             rt                   = TextBubbleManager.TBM.TextBubbleText.GetComponent <RectTransform>();
             rt.localScale        = new Vector3(1, 1, 1);
             transform.localScale = new Vector3(0.2f, transform.localScale.y, transform.localScale.z);
             TextBubbleManager.TBM.TextBubble.transform.position = new Vector3(-1.5f, headPosition.position.y, headPosition.position.z);
             CameraFollowScript.CFS.isLeft = true;
         }
         else if (playerPosition.x > headPosition.position.x)
         {
             RectTransform rt = TextBubbleManager.TBM.TextBubble.GetComponent <RectTransform>();
             rt.localScale        = new Vector3(-1, 1, 1);
             rt                   = TextBubbleManager.TBM.TextBubbleText.GetComponent <RectTransform>();
             rt.localScale        = new Vector3(-1, 1, 1);
             transform.localScale = new Vector3(-0.2f, transform.localScale.y, transform.localScale.z);
             TextBubbleManager.TBM.TextBubble.transform.position = new Vector3(1.5f, headPosition.position.y, headPosition.position.z);
             CameraFollowScript.CFS.isLeft = false;
         }
         leftFacing.SetActive(true);
         DownFacing.SetActive(false);
         TextBubbleManager.TBM.EnableTextBox();
         if (PlayerMovementController.PMC.playerGameState == 3)
         {
             canDisappear = true;
         }
     }
     interactionPressed = false;
     if (!TextBubbleManager.TBM.textBubbleActive)
     {
         leftFacing.SetActive(false);
         DownFacing.SetActive(true);
         if (canDisappear)
         {
             StartCoroutine(destroyWhenFinished());
         }
     }
 }