Ejemplo n.º 1
0
    public static void SetOpacityToGameObject(float opacity, GameObject obj)
    {
        CFontRenderer font = obj.GetComponent <CFontRenderer>();

        if (font != null)
        {
            font.mColor.a = opacity;
            if (opacity <= 0.0f)
            {
                font.setEnabled(false);
            }
            else
            {
                font.setEnabled(true);
            }
        }
        CDiffuseRenderer diffuse = obj.GetComponent <CDiffuseRenderer>();

        if (diffuse != null)
        {
            Color clr = diffuse.GetMaterial().GetColor();
            clr.a = opacity;
            diffuse.GetMaterial().SetColor(clr);

            if (opacity <= 0.0f)
            {
                diffuse.setEnabled(false);
            }
            else
            {
                diffuse.setEnabled(true);
            }
        }
    }
Ejemplo n.º 2
0
    public override void OnMouseOver()
    {
        CFontRenderer sub = GetSubtitleFont();

        if (!sub.isEnabled())
        {
            sub.setEnabled(true);
            sub.mText = "Click to Interact";
        }

        switch (currEvent)
        {
        case CONSOLE_EVENT.DOOR_MINIGAME_TURN:
        {
            CFontRenderer fontOfInput = mExtraTexts[1].GetComponent <CFontRenderer>();
            fontOfInput.mColor = mColorOfText;         // Change to green when mouse-overed
        }
        break;

        case CONSOLE_EVENT.MINIGAME_FOUR_PLAYERS:
        {
            CFontRenderer fontOfInput = mExtraTexts[1].GetComponent <CFontRenderer>();
            fontOfInput.mColor = mColorOfText;         // Change to green when mouse-overed
        }
        break;
        }
    }
 public CFontRenderer GetSubtitleFont()
 {
     if (subtitle == null)
     {
         subtitle = GameObject.GetGameObjectByName(subtitleName).RequireComponent <CFontRenderer>();
         subtitle.setEnabled(false);
     }
     return(subtitle);
 }
Ejemplo n.º 4
0
    public override void OnMouseOver()
    {
        CFontRenderer sub = GetSubtitleFont();

        if (!sub.isEnabled())
        {
            sub.setEnabled(true);
            sub.mText = "Click Drag to Look Around";
        }
    }
Ejemplo n.º 5
0
    public override void OnMouseOver()
    {
        CFontRenderer sub = GetSubtitleFont();

        if (!sub.isEnabled())
        {
            sub.setEnabled(true);
            sub.mText = "Spin!";
        }
    }
Ejemplo n.º 6
0
 public override void OnMouseOver()
 {
     if (foundCar)
     {
         CFontRenderer sub = GetSubtitleFont();
         if (!sub.isEnabled())
         {
             sub.setEnabled(true);
             sub.mText = "Click Drag to Move RC Car";
         }
     }
 }
Ejemplo n.º 7
0
    public void SetNumber(int num, int id)
    {
        Init();

        mPanelNumber = num; // Which panel in the sequence to be stepped on
        mPanelID     = id;

        if (mPanelNumber < 0)
        {
            numberText.setEnabled(false); // no number for unsafe panels

            screen.GetMaterial().SetColor(redColor);
        }
        else
        {
            numberText.setEnabled(true);
            int number = mPanelNumber + 1;
            numberText.mText = number.ToString();

            screen.GetMaterial().SetColor(defaultColor);
        }
    }
Ejemplo n.º 8
0
    public override void OnMouseOver()
    {
        if (isActive)
        {
            camInMapSelector.setEnabled(true);
            Vector3 camDir = ocuCam.transform.GetForwardVector();
            // Move it infront of the camInMap Icon
            camInMapSelector.gameObject.transform.SetPosition(
                (Vector3)camInMapIcon.transform.position - camDir * 0.001f);


            CFontRenderer sub = GetSubtitleFont();
            if (!sub.isEnabled())
            {
                sub.setEnabled(true);
                sub.mText = "Click to Switch Camera";
            }
        }
    }
Ejemplo n.º 9
0
    void UpdateEvent(float dt)
    {
        switch (currEvent)
        {
        case CONSOLE_EVENT.BOOBY_TRAP:
        {
            CFontRenderer alertTextFont = mExtraTexts[0].GetComponent <CFontRenderer>();
            if (eventState == 0)         // waiting for codes to show
            {
                eventTimer -= dt;
                if (eventTimer <= 0.0f)
                {
                    eventState = 1;         // Show the countdown timer
                    eventTimer = 100.0f;
                    alertTextFont.setEnabled(true);
                }
            }
            else if (eventState == 1)
            {
                eventTimer -= dt;
                if (eventTimer <= 0.0f)
                {
                    eventState = 2;
                    eventTimer = 0.0f;

                    BoobyTrapDeactivatorController boobyTrapScript = GetScript <BoobyTrapDeactivatorController>(savedObject, false);
                    if (boobyTrapScript != null)
                    {
                        boobyTrapScript.TimeIsUp();
                    }
                    QueueMessage("Lockdown is in effect.\\n<#1,0,0,1#>Now cleansing Terminal 2 of organic matter.", 0.0f, true, true);
                }
                alertTextFont.mText = "Lockdown in\\n<#1,0,0,1#>" + eventTimer.ToString("0.00");         // 2 decimal places
            }
        }
        break;
        }
    }
Ejemplo n.º 10
0
    public void BoobyTrapEvent(int numberCode, GameObject obj, bool isDeactivated) // pass in -1 to reset
    {
        if (isDeactivated)                                                         // End of trap
        {
            QueueMessage("Override successful. Lockdown deactivated.", 0.0f, false, true);
            QueueMessage("Laboratory access granted.", 1.6f, false, false);

            ResetToDefaultState();
        }
        else // Start
        {
            if (currEvent != CONSOLE_EVENT.BOOBY_TRAP) // First time trigger into booby trap
            {
                savedObject = obj;
                eventTimer  = 5.0f;
                eventState  = 0;

                ChangeHeader("Lockdown System:");
                QueueMessage("Intruder detected! Lockdown initiated.", 0.0f, false, true);
                QueueMessage("Override codes:\\n20, 43, 55, 82, 13, 59, 94, 35, 11", 0.6f, false, false);
                currEvent = CONSOLE_EVENT.BOOBY_TRAP;

                // Create an alert screen
                GameObject alertText = ObjectFactory.getInstance().Instantiate(Common.nameForFixedWidthText);
                Vector3    alertPos  = mCenterPosForText;
                alertPos.X += 2.4f;
                alertPos.Y += 1.5f;
                alertText.transform.SetPosition(alertPos);
                CFontRenderer alertTextFont = alertText.GetComponent <CFontRenderer>();
                alertTextFont.mText           = "";
                alertTextFont.mFontScale      = 0.0032f;
                alertTextFont.mNewlineSpacing = 1.1f;
                alertTextFont.mJustification  = CFontRenderer.FONT_JUSTIFICATION.CENTER_JUSTIFIED;
                alertTextFont.setEnabled(false);

                // Create game screen column itself
                GameObject headerText = ObjectFactory.getInstance().Instantiate(Common.nameForFixedWidthText);
                Vector3    headerPos  = mCenterPosForText;
                headerPos.X += 2.4f;
                headerPos.Y += 0.6f;
                headerText.transform.SetPosition(headerPos);
                CFontRenderer headerTextFont = headerText.GetComponent <CFontRenderer>();
                headerTextFont.mText          = "Code: ";
                headerTextFont.mJustification = CFontRenderer.FONT_JUSTIFICATION.RIGHT_JUSTIFIED;

                // Create "Input ..." feedback at the btm
                GameObject btmText = ObjectFactory.getInstance().Instantiate(Common.nameForFixedWidthText);
                Vector3    btmPos  = headerPos;
                btmText.transform.SetPosition(btmPos);
                CFontRenderer btmTextFont = btmText.GetComponent <CFontRenderer>();
                btmTextFont.mText           = "__\\n__\\n__\\n__";
                btmTextFont.mFontScale      = 0.003f;
                btmTextFont.mJustification  = CFontRenderer.FONT_JUSTIFICATION.LEFT_JUSTIFIED;
                btmTextFont.mNewlineSpacing = 1.5f;

                // Create divider
                GameObject dottedLine = CreateDividerText();

                mExtraTexts.Add(alertText);
                mExtraTexts.Add(headerText);
                mExtraTexts.Add(btmText);
                mExtraTexts.Add(dottedLine);
            }
            else
            {
                CFontRenderer btmTextFont = mExtraTexts[2].GetComponent <CFontRenderer>();
                if (numberCode < 0) // Clear the screen back to __
                {
                    btmTextFont.mText = "__\\n__\\n__\\n__";
                }
                else // Add another correct number
                {
                    int indexToInsert = btmTextFont.mText.IndexOf("__");
                    if (indexToInsert >= 0)
                    {
                        string newString = btmTextFont.mText.Remove(indexToInsert, 2);
                        btmTextFont.mText = newString.Insert(indexToInsert, "<#0,1,0,1#>" + numberCode.ToString() + "<#1,1,1,1#>");
                    }
                }
            }
        } // End of if in activated state
    }