Example #1
0
    private void SetMeAsReferenceToInGameUIManager()
    {
        if (!inGameUIManagerRefOfMeIsSet)
        {
            if (amIPlayerOne)
            {
                inGameUIManager_Ref.PlayerOnePrintText_Ref = this;
                inGameUIManagerRefOfMeIsSet = true;
            }
            else
            {
                if (inGameUIManager_Ref != null)
                {
                    inGameUIManager_Ref.PlayerTwoPrintText_Ref = this;

                    inGameUIManagerRefOfMeIsSet = true;
                }
                else
                {
                    inGameUIManager_Ref = InGameUIManager.GetInstance();

                    if (inGameUIManager_Ref != null)
                    {
                        inGameUIManager_Ref.PlayerTwoPrintText_Ref = this;

                        inGameUIManagerRefOfMeIsSet = true;
                    }
                    else
                    {
                        Debug.Log("PrintText on: " + gameObject.name + ", is missing a value for inGameUIManager_Ref");
                    }
                }
            }
        }
    }
 public void GetAllNeededReferences()
 {
    if(inGameUIManager_Ref == null)
         inGameUIManager_Ref = InGameUIManager.GetInstance();
     if (bubbleManager_Ref == null)
         bubbleManager_Ref = BubbleManager.GetInstance();
 }
Example #3
0
    void Start()
    {
        gameStateMachine_Ref = GameStateMachine.GetInstance();

        myImage         = GetComponent <Image>();
        addToFrameIndex = true;

        if (amountOfLoops == 0)
        {
            amountOfLoops = 1;
        }
        if (frameInterval == 0)
        {
            frameInterval = 0.1f;
        }

        if (gameStateMachine_Ref.devMode)
        {
            Destroy(this);
        }
        if (playerOne && !victoryScreen)
        {
            mySprites = gameStateMachine_Ref.PlayerCharacterArray[0].MySprites;

            if (!introText)
            {
                InGameUIManager.GetInstance().playerOneUIAnim_Ref = this;
            }
            else
            {
                InGameUIManager.GetInstance().playerOneIntroUIAnim_Ref = this;
            }
        }
        else
        {
            mySprites = gameStateMachine_Ref.PlayerCharacterArray[1].MySprites;
            if (!introText)
            {
                InGameUIManager.GetInstance().playerTwoUIAnim_Ref = this;
            }
            else
            {
                InGameUIManager.GetInstance().playerTwoIntroUIAnim_Ref = this;
            }
        }

        if (victoryScreen)
        {
            if (gameStateMachine_Ref.PlayerOneWon)
            {
                mySprites = gameStateMachine_Ref.PlayerCharacterArray[0].MySprites;
            }
            else
            {
                mySprites = gameStateMachine_Ref.PlayerCharacterArray[1].MySprites;
            }
            myPrintText = transform.parent.GetComponentInChildren <PrintText>();
        }
    }
Example #4
0
    private void SetReferences()
    {
        gameStateMachine_Ref = GameStateMachine.GetInstance();

        if (amIPlayerOne)
        {
            playerPortraitDisplay.sprite = gameStateMachine_Ref.PlayerCharacterArray[0].MyPicture;
            InGameUIManager.GetInstance().PlayerOneInfo_Ref = this;
        }
        else
        {
            playerPortraitDisplay.sprite = gameStateMachine_Ref.PlayerCharacterArray[1].MyPicture;
            InGameUIManager.GetInstance().PlayerTwoInfo_Ref = this;
        }

        if (playerNameDisplay == null)
        {
            if (transform.GetChild(0) != null && transform.GetChild(0).GetComponent <Text>() != null)
            {
                playerNameDisplay = transform.GetChild(0).GetComponent <Text>();
            }
            else
            {
                Debug.Log("PlayerInfo, player one: " + amIPlayerOne + " , can't get a" +
                          " reference to playerNameDisplay Text");
            }
        }

        if (playerPortraitDisplay == null)
        {
            if (transform.GetChild(2) != null && transform.GetChild(2).GetComponent <Image>() != null)
            {
                playerPortraitDisplay = transform.GetChild(2).GetComponent <Image>();
            }
            else
            {
                Debug.Log("PlayerInfo, player one: " + amIPlayerOne + " , can't get a" +
                          " reference to playerPortrait Image");
            }
        }
    }
Example #5
0
 private void SetMyReference()
 {
     if (InGameUIManager.GetInstance() != null)
     {
         if (amIPlayerOne)
         {
             if (InGameUIManager.GetInstance().PlayerOneInfo_Ref != null)
             {
                 InGameUIManager.GetInstance().PlayerOneInfo_Ref.playerStatusDisplay = GetComponent <Text>();
             }
             else
             {
                 Debug.Log("InGameUIManager is missing a ref to PlayerOneInfo_Ref");
             }
         }
         else
         {
             InGameUIManager.GetInstance().PlayerTwoInfo_Ref.playerStatusDisplay = GetComponent <Text>();
         }
     }
 }
Example #6
0
    private void SetReferencesAndStartValues()
    {
        gameStateMachine_Ref = GameStateMachine.GetInstance();
        if (GetComponent <Text>() != null)
        {
            myText = GetComponent <Text>();
        }
        else
        {
            Debug.Log("PrintText can't get a Text reference for the variable myText");
        }

        if (inGameUIManager_Ref == null)
        {
            inGameUIManager_Ref = InGameUIManager.GetInstance();
        }

        //Check if I can print right away, if I have to wait for
        //player one taunt text to print first or if the game is
        //over and I can print at once.
        if (amIPlayerOne || gameStateMachine_Ref.GameOver)
        {
            canIPrint = true;
            if (inGameUIManager_Ref.playerOneIntroUIAnim_Ref != null)
            {
                inGameUIManager_Ref.playerOneIntroUIAnim_Ref.isTalking = true;
            }
        }


        if (amIPlayerOne)
        {
            if (inGameUIManager_Ref.PlayerOnePrintText_Ref == null)
            {
                inGameUIManager_Ref.PlayerOnePrintText_Ref = this;
                inGameUIManagerRefOfMeIsSet = true;
            }
        }
        else
        {
            if (inGameUIManager_Ref != null)
            {
                inGameUIManager_Ref.PlayerTwoPrintText_Ref = this;
                inGameUIManagerRefOfMeIsSet = true;
            }
            else
            {
                inGameUIManager_Ref = InGameUIManager.GetInstance();

                if (inGameUIManager_Ref != null)
                {
                    inGameUIManager_Ref.PlayerTwoPrintText_Ref = this;
                    inGameUIManagerRefOfMeIsSet = true;
                }
                else
                {
                    Debug.Log("PrintText on: " + gameObject.name + ", is missing a value for inGameUIManager_Ref");
                }
            }
        }

        charArrayIndex         = 0;
        isFullMessageShown     = false;
        currentStringToDisplay = "";
    }