Awake() static private method

static private Awake ( ) : void
return void
Exemplo n.º 1
0
    void Update()
    {
        if (bUpdateOn)
        {
            // Temp: Update Camera display / aspect ratio
            if (Input.GetKeyUp(KeyCode.R) ||
                Input.GetKeyUp(KeyCode.JoystickButton6))
            {
                aspectUtil.Awake();
            }

            // Camera stays w/in the bounds set here while following the player
            minCamX = 1.053f * myCam.orthographicSize - 0.9398f;
            minCamY = 0.6316f * myCam.orthographicSize - 6.564f;
            maxCamX = -1.053f * myCam.orthographicSize + 10.94f;
            maxCamY = -0.6316f * myCam.orthographicSize + 0.5639f;

            float posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime);
            float posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime);
            transform.position = new Vector3(
                Mathf.Clamp(posX, minCamX, maxCamX),
                Mathf.Clamp(posY, minCamY, maxCamY),
                -10f);
        }
    }
Exemplo n.º 2
0
 public void ResetParameters()
 {
     aspectUtil.Awake();
     dMan.ConfigureParameters();
     oMan.ConfigureParameters();
     uMan.CheckAndSetMenus();
 }
    public void CollisionBundle() // Note: order is important
    {
        // Reset Camera dimension / ratio incase screen size changed at all (e.g. WebGL Fullscreen)
        aspectUtil.Awake();

        // "Stop" player animation
        if (playerAnim)
        {
            playerAnim.speed = 0.0001f;
        }

        // Unsync and stop camera tracking
        cameraFollow.currentCoords = 0;

        // Hide UI (if present) and prevent input
        if (cameraSlider)
        {
            cameraSlider.bTempControlActive = uMan.bControlsActive;
        }

        touches.transform.localScale = Vector3.zero; // 05/10/2019 DC TODO -- Change this to uMan.HideControls()?
        touches.UnpressedAllArrows();

        // Prevent player movement
        bStopPlayerMovement = true;

        // Prevent player interactions (e.g. other tripwires)
        if (playerCollider)
        {
            playerCollider.enabled = false;
        }
    }
    void Update()
    {
        // Temp: Update Camera display / aspect ratio
        if (Input.GetKeyUp(KeyCode.R) ||
            //Input.GetKeyUp(KeyCode.JoystickButton6))
            contSupp.ControllerMenuLeft("up"))
        {
            aspectUtil.Awake();
            ConfigureParameters();
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            Debug.Log("W:" + Screen.width);
            Debug.Log("H:" + Screen.height);
            //Debug.Log("CW:" + showdownCamera.pixelWidth);

            //Debug.Log("R:" + (float)(Screen.width/showdownCamera.pixelWidth));
        }

        // Advance active dialogues
        if ((bDialogueActive && Input.GetKeyDown(KeyCode.Space)) ||
            (bDialogueActive && Input.GetMouseButtonDown(0)) ||
            (bDialogueActive && touches.bAaction))
        {
            currentLine++;
        }

        // End of dialogue => reset everything
        if (currentLine >= dialogueLines.Length)
        {
            dbox.SetActive(false);
            bDialogueActive = false;

            currentLine = 0;
        }

        // Set current text
        dText.text = dialogueLines[currentLine];
    }
    public void ResetParameters()
    {
        Debug.Log("resetting");

        if (aspectUtil)
        {
            aspectUtil.Awake();
        }
        if (dMan)
        {
            dMan.ConfigureParameters();
        }
        if (oMan)
        {
            oMan.ConfigureParameters();
        }
        if (fixedJoy)
        {
            fixedJoy.JoystickPosition();
        }

        if (uMan)
        {
            uMan.SetMenus();
            uMan.SetOrientation();
        }

        if (sMan)
        {
            sMan.ResetParameters("CS_TreeTunnel");
            sMan.ResetParameters("CS_TyrannyTunnel");
            sMan.ResetParameters("MainMenu");
            sMan.ResetParameters("SceneTransitioner");
            sMan.ResetParameters("TD_SBF_L1");
            sMan.ResetParameters("TD_SBF_MenuController");
            sMan.ResetParameters("TD_SBF_ModeSelector");
        }
    }
    void Update()
    {
        // Temp: Update Camera display / aspect ratio
        if (Input.GetKeyUp(KeyCode.R) ||
            contSupp.ControllerMenuLeft("up"))
        {
            aspectUtil.Awake();
        }

        if (scene.name == "GuessWhoColluded")
        {
            // Camera stays w/in the bounds set here while following the player
            minCamX = 1.053f * myCam.orthographicSize - 0.9398f;
            minCamY = 0.6316f * myCam.orthographicSize - 6.564f;
            maxCamX = -1.053f * myCam.orthographicSize + 10.94f;
            maxCamY = -0.6316f * myCam.orthographicSize + 0.5639f;

            posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime);
            posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime);
            transform.position = new Vector3(
                Mathf.Clamp(posX, minCamX, maxCamX),
                Mathf.Clamp(posY, minCamY, maxCamY),
                depth);
        }
        else if (scene.name == "Minesweeper")
        {
            posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime);
            posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime);
            transform.position = new Vector3(posX, posY, depth);
        }
        else if (myCam.GetComponent <CameraSlider>())
        {
            if (!myCam.GetComponent <CameraSlider>().bIsSliding)
            {
                // Camera follows the player with a slight delay
                posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref smoothVelocity.x, smoothTime);
                posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref smoothVelocity.y, smoothTime);
                transform.position = new Vector3(posX, posY, depth);

                // Camera bounds per area
                // Areas listed alphabetically
                // Note: Float multiplier is macro-position away from bottom left (origin)
                // DC 09/25/2017 -- TODO: Possible performance upgrade based on most visited at the top
                if (currentCoords == AnandaCoords.BatteryNE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 3.0f),
                            (maxCamPos.x + 5.12f * 3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 0.0f),
                            (maxCamPos.y + 5.12f * 0.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BatteryNW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 2.0f),
                            (maxCamPos.x + 5.12f * 2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 0.0f),
                            (maxCamPos.y + 5.12f * 0.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BatterySE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 3.0f),
                            (maxCamPos.x + 5.12f * 3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BatterySW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 2.0f),
                            (maxCamPos.x + 5.12f * 2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BuildersNE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 0.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 1.0f),
                            (maxCamPos.y + 5.12f * 1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BuildersNW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -1.0f),
                            (maxCamPos.x + 5.12f * -1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 1.0f),
                            (maxCamPos.y + 5.12f * 1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BuildersSE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 0.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 0.0f),
                            (maxCamPos.y + 5.12f * 0.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.BuildersSW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -1.0f),
                            (maxCamPos.x + 5.12f * -1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 0.0f),
                            (maxCamPos.y + 5.12f * 0.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.Campus)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.CannaFieldNW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -2.0f),
                            (maxCamPos.x + 5.12f * -2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.CannaFieldSE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -1.0f),
                            (maxCamPos.x + 5.12f * -1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -3.0f),
                            (maxCamPos.y + 5.12f * -3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.CannaFieldSW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -2.0f),
                            (maxCamPos.x + 5.12f * -2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -3.0f),
                            (maxCamPos.y + 5.12f * -3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.CannaHouse)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -1.0f),
                            (maxCamPos.x + 5.12f * -1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmNW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -3.0f),
                            (maxCamPos.y + 5.12f * -3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmNC)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 2.0f),
                            (maxCamPos.x + 5.12f * 2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -3.0f),
                            (maxCamPos.y + 5.12f * -3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmNE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 3.0f),
                            (maxCamPos.x + 5.12f * 3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -3.0f),
                            (maxCamPos.y + 5.12f * -3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmWC)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -4.0f),
                            (maxCamPos.y + 5.12f * -4.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmCC)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 2.0f),
                            (maxCamPos.x + 5.12f * 2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -4.0f),
                            (maxCamPos.y + 5.12f * -4.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmEC)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 3.0f),
                            (maxCamPos.x + 5.12f * 3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -4.0f),
                            (maxCamPos.y + 5.12f * -4.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmSW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -5.0f),
                            (maxCamPos.y + 5.12f * -5.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmSC)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 2.0f),
                            (maxCamPos.x + 5.12f * 2.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -5.0f),
                            (maxCamPos.y + 5.12f * -5.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.FarmSE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 3.0f),
                            (maxCamPos.x + 5.12f * 3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -5.0f),
                            (maxCamPos.y + 5.12f * -5.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.Home)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -3.0f),
                            (maxCamPos.x + 5.12f * -3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.HousesE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 4.0f),
                            (maxCamPos.x + 5.12f * 4.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.HousesN)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 0.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 2.0f),
                            (maxCamPos.y + 5.12f * 2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.HousesS)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -6.0f),
                            (maxCamPos.y + 5.12f * -6.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.HousesW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -4.0f),
                            (maxCamPos.x + 5.12f * -4.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.Lake)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 3.0f),
                            (maxCamPos.y + 5.12f * 3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.PlaygroundE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 5.0f),
                            (maxCamPos.x + 5.12f * 5.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.PlaygroundN)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 1.0f),
                            (maxCamPos.x + 5.12f * 1.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 2.0f),
                            (maxCamPos.y + 5.12f * 2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.PlaygroundS)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 0.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -6.0f),
                            (maxCamPos.y + 5.12f * -6.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.PlaygroundW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -3.0f),
                            (maxCamPos.x + 5.12f * -3.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * -1.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.RaceTrackE)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 5.0f),
                            (maxCamPos.x + 5.12f * 5.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -2.0f),
                            (maxCamPos.y + 5.12f * -2.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.River)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * 0.0f),
                            (maxCamPos.x + 5.12f * 0.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 3.0f),
                            (maxCamPos.y + 5.12f * 3.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.WoodsW)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -5.0f),
                            (maxCamPos.x + 5.12f * -4.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * -1.0f),
                            (maxCamPos.y + 5.12f * 0.0f)),
                        depth);
                }
                else if (currentCoords == AnandaCoords.WoodsWSecret)
                {
                    transform.position = new Vector3(
                        Mathf.Clamp(
                            transform.position.x,
                            (minCamPos.x + 5.12f * -4.0f),
                            (maxCamPos.x + 5.12f * -4.0f)),
                        Mathf.Clamp(
                            transform.position.y,
                            (minCamPos.y + 5.12f * 1.0f),
                            (maxCamPos.y + 5.12f * 1.0f)),
                        depth);
                }
                else
                {
                    transform.position = new Vector3(
                        transform.position.x,
                        transform.position.y,
                        -10
                        );
                }
            }
        }
    }