Inheritance: MonoBehaviour
 private void InitialiseControls()
 {
     playerInput = new CameraControls();
     playerInput.Camera.Zoom.performed += OnZoom;
     playerInput.Camera.SecondaryTouchContact.started  += StartTouchZoom;
     playerInput.Camera.SecondaryTouchContact.canceled += EndTouchZoom;
 }
Esempio n. 2
0
 private void Awake()
 {
     playerInputs        = GetComponent <PlayerInputs>();
     controller          = GetComponent <CharacterController>();
     cameraControls      = GetComponent <CameraControls>();
     animationController = GetComponent <AnimationController>();
 }
Esempio n. 3
0
    // Use this for initialization
    void CreateSun()
    {
        this.planetPlaceholder = Instantiate(planetPlaceholderPrefab);
        this.planetPlaceholder.SetActive(false);

        // Create a SUN
        Vector3    sunpos = new Vector3(Random.Range(-100f, 100f), 0, Random.Range(-100f, 100f));
        GameObject sun    = PhotonNetwork.Instantiate("Sun", sunpos, Quaternion.identity, 0);
        //GameObject sun = Instantiate (sunPrefabs [Random.Range (0, sunPrefabs.Count - 1)]);
        Sun obj = sun.GetComponent <Sun> ();

        obj.owner = GameProperties.props.playerName;
        obj.type  = PlanetType.Sun;
        obj.SetColor(new Color(Random.value, Random.value, Random.value));
        GameProperties.props.mySun = sun;

        CameraControls cam = Camera.main.GetComponent <CameraControls> ();

        if (cam != null)
        {
            cam.PointAt(sun);
        }

        GameProperties.props.state = GameState.Playing;
    }
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        game_master_script = GameObject.Find("GameMaster").GetComponent <GameMasterScript>();
        camera_script      = GameObject.Find("Main Camera").GetComponent <CameraControls>();

        GameObject win_trigger = GameObject.FindWithTag("Goal");

        win_trigger_trans  = win_trigger.GetComponent <Transform>();
        win_trigger_script = win_trigger.GetComponent <WinTrigger>();

        eye_trans = eye.GetComponent <Transform>();
        eye_mat   = eye.GetComponent <MeshRenderer>().materials[0];

        //beam_mat = beam.GetComponent<MeshRenderer>().materials[0];
        beam_trans = beam.GetComponent <Transform>();
        beam.SetActive(false);
        beaming = false;

        moving    = false;
        direction = new Vector3();
        next_pos  = rb.position;

        rotation = rb.rotation.y;
        pushing  = false;
        speed    = Utility.CHARACTER_SPEED;

        elevator_trigger = false;

        //emission_color = Color.black;
        intensity = 0;
        SetLight(intensity);
    }
 // Use this for initialization
 void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     cameraControls = Camera.main.GetComponent <CameraControls>();
     //audioSource = GetComponent<AudioSource>();
     //anim = GetComponent<Animator>();
 }
Esempio n. 6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            if (this != instance)
            {
                Destroy(this.gameObject);
            }
        }

        Camera = GameObject.FindObjectOfType<CameraControls>();
        if (Camera == null)
        {
            Debug.Log("Cannot find camera on the current scene.");
        }

        Players = new List<Player>(GameObject.FindObjectsOfType<Player>());
        if (Players == null)
        {
            Debug.Log("Cannot find players on the current scene.");
        }
    }
Esempio n. 7
0
    // Use this for initialization
    void Awake()
    {
        Application.targetFrameRate = 60;

        Instance = this;

        pointsText.text = gamePoints.ToString();

        UpgradeUI.SetActive(false);
        DemolishUI.SetActive(false);
        IncreaseWorkersUI.SetActive(false);

        ConstructionHandler = FindObjectOfType <ConstructionHandler>();
        CitizenManager      = FindObjectOfType <CitizenManager>();
        AudioManager        = FindObjectOfType <AudioManager>();
        CPRData             = FindObjectOfType <CPRAccountData>();

        CameraControls = FindObjectOfType <CameraControls> ();
        MeteorHandler  = FindObjectOfType <MeteorHandler> ();

        Blockzilla   = Resources.Load <GameObject>("Events/Blockzilla");
        Blockman     = Resources.Load <GameObject>("Events/Blockman");
        SmallHouses  = Resources.LoadAll <GameObject>("Buildings/SmallHouses");
        MediumHouses = Resources.LoadAll <GameObject>("Buildings/MediumHouses");
        LargeHouses  = Resources.LoadAll <GameObject>("Buildings/LargeHouses");
        Specials     = Resources.LoadAll <GameObject>("Buildings/Special");

        MoneyText.text = "Money: " + CPRData.currentBalance.ToString("N2");
        ResetDailyMoney();
    }
Esempio n. 8
0
    /*public static void LoadScene(string sceneName, bool persistPlayer = true)
     * {
     *  if (persistPlayer)
     *      DontDestroyOnLoad(Player);
     *  else
     *  {
     *      Destroy(Player);
     *      _player = null;
     *  }
     *
     *  Application.LoadLevel(sceneName);
     *
     *  FindPlayer();
     *  FindCamera();
     * }*/

    private static void FindCamera()
    {
        _camera = FindObjectOfType <CameraControls>();
        if (_camera == null)
        {
            Debug.Log("Cannot find camera on the current scene.");
        }
    }
Esempio n. 9
0
 private void Awake()
 {
     GV         = GameObject.FindGameObjectWithTag("GameController").GetComponent <GlobalVariables>();
     cmr        = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraControls>();
     score      = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreCounter>();
     Ccube      = this.transform;
     CcubeScale = Ccube.localScale.x;
 }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     inst = this;
     camc = Cam.gameObject.GetComponent<CameraControls>();
     DebugConsole.RegisterCommand("Pause", Pause);
     CanPause = true;
     //var x = gameObject.GetComponent<WindZone>();
 }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <PlayerController>();

        camera = FindObjectOfType <CameraControls>();

        health = FindObjectOfType <HealthManager>();
    }
Esempio n. 12
0
    private void Awake()
    {
        singleton = this;

        pivot            = transform.GetChild(0);
        cam              = pivot.GetChild(0);
        transform.parent = null;
    }
Esempio n. 13
0
 // Use this for initialization
 void Start()
 {
     GV      = GameObject.FindGameObjectWithTag("GameController").GetComponent <GlobalVariables>();
     score   = GV.GetComponent <ScoreCounter>();
     cubegen = GameObject.FindGameObjectWithTag("CenterCube").GetComponent <BCubeGenerate>();
     cmr     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraControls>();
     Ccube   = cubegen.Ccube;
 }
Esempio n. 14
0
 private void Awake()
 {
     gameObject.transform.parent = null;
     animator   = GetComponentInChildren <Animator>();
     timer      = Camera.main.GetComponent <Timer>();
     rigidBody  = GetComponent <Rigidbody>();
     mainCamera = FindObjectOfType <Camera>();
     mainCamera.GetComponent <CameraControls>().SetCamera();
     cameraControls = (CameraControls)Camera.main.GetComponent(typeof(CameraControls));
 }
Esempio n. 15
0
 // Use this for initialization
 void Start()
 {
             #if !UNITY_EDITOR && UNITY_WEBGL
     UnityEngine.WebGLInput.captureAllKeyboardInput = false;
             #endif
     Application.ExternalCall("onUnityAppReady", "Hello from Unity!");
     Debug.Log(Camera.main);
     cameraControls = Camera.main.transform.GetComponent <CameraControls> ();
     this.CreateMap();
 }
    // Update is called once per frame
    void LateUpdate()
    {
        CameraControls cameraControl = mainCamera.GetComponent("CameraControls") as CameraControls;

        if (cameraControl.target != null)
        {
            transform.position = new Vector3(mainCamera.transform.position.x, cameraControl.target.transform.position.y, mainCamera.transform.position.z);

            transform.LookAt(cameraControl.target.transform.position);
        }
    }
Esempio n. 17
0
 void Awake()
 {
     if (CameraControls.instance == null)
     {
         instance = this;
     }
     else if (this != instance)
     {
         Destroy(this.gameObject);
     }
 }
Esempio n. 18
0
 private void updateView()
 {
     try
     {
         CameraControls.changeBody(bodySelector.options[bodySelector.value].text);
     }
     catch (System.Exception)
     {
         // No Bodies to View. Ignore, will be refreshed once bodies are loaded.
     }
 }
Esempio n. 19
0
    //Private Static

    /// <summary>
    /// Initializes generalized game variables
    /// </summary>
    /// <param name="boundsMesh">mesh to calculate bounds from</param>
    /// <param name="numberOfSworks">number of sworks to be used this level</param>
    /// <param name="sworkPrefab">prefab of swork to sapwn</param>
    /// <param name="holdingArea">off map position to store dead sworks</param>
    /// <param name="cameraUsed">the main camera used</param>
    public static void ReadyGame(MeshRenderer boundsMesh, int numberOfSworks, GameObject sworkPrefab, Transform holdingArea, Camera cameraUsed)
    {
        //initialize protected classes
        SworkControl.ReadySworkControl(numberOfSworks, sworkPrefab, holdingArea);
        InputControl.ReadyInput(Application.platform);
        CameraControls.ReadyCamera(cameraUsed);

        //set game start state
        CurrentGameState.CurrentPlayState    = GameState.PlayState.Play;
        CurrentGameState.CurrentControlState = GameState.ControlState.ManualControl;

        CalculateBound(boundsMesh);
    }
Esempio n. 20
0
    void Start()
    {
        globalCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraControls> ();

        if (this.name == "Sun Holder")
        {
            isSun = true;
        }
        else
        {
            tr = GetComponent <TrailRenderer> ();
        }
    }
    void Awake()
    {
        cam = Camera.main.GetComponent <CameraControls>();
        mnl = go_NextLevel.GetComponent <ManualLevelUnlock>();
        if (PlayerPrefs.HasKey("currentCamPos") && cam.cameraPosition == CameraControls.CameraPosition.SaveCurrent)
        {
            cam.defaultPosition = PlayerPrefsX.GetVector3("currentCamPos");
        }
        //Check if player prefs have any data with levels indexes, if so - assign;

        if (PlayerPrefs.HasKey("isFinished" + LevelIndex.ToString()))
        {
            isFinished = PlayerPrefsX.GetBool("isFinished" + LevelIndex.ToString());
        }
        if (PlayerPrefs.HasKey("startsCount" + LevelIndex.ToString()))
        {
            starsCount = PlayerPrefs.GetInt("startsCount" + LevelIndex.ToString());
        }
        //draw stats depends on how much stars we gained;
        if (starsCount == 1)
        {
            Stats.sprite = OneStar;
        }
        if (starsCount == 2)
        {
            Stats.sprite = TwoStars;
        }
        if (starsCount == 3)
        {
            Stats.sprite = ThreeStars;
        }

        //unlock next level;
        if (starsCount >= 1)
        {
            mnl.unlocked = true;
        }

        //draw unlock level sprite if level is unlocked and conversely;
        if (unlocked)
        {
            Stats.gameObject.SetActive(true);
            LevelObject.sprite = LevelUnlocked;
        }
        else
        {
            Stats.gameObject.SetActive(false);
            LevelObject.sprite = LevelLocked;
        }
    }
Esempio n. 22
0
    // Use this for initialization
    void Start()
    {
        dungeonManagerScript = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent("DungeonManager") as DungeonManager;
        uiManagerScript = GameObject.FindGameObjectWithTag("uiManager").GetComponent("UIManager") as UIManager;

        uiManagerScript.InitValues(dungeonManagerScript.width, dungeonManagerScript.height, dungeonManagerScript.minRoomSize, dungeonManagerScript.maxRoomSize,
                                   dungeonManagerScript.chanceOfExtraDoor, false);
        camControls = GameObject.FindGameObjectWithTag("MainCamera").GetComponent("CameraControls") as CameraControls;

        if (Cursor.lockState == CursorLockMode.Locked){
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;
        }
    }
Esempio n. 23
0
    private void Awake()
    {
        //Singleton
        if (inst == null)
        {
            inst = this;
        }
        else if (inst != this)
        {
            Destroy(FindObjectOfType <CameraControls>().gameObject);
        }

        DontDestroyOnLoad(this.gameObject);
    }
Esempio n. 24
0
    public override void _Ready()
    {
        if (_cc == null)
        {
            _cc = this;
        }
        else
        {
            QueueFree();
        }

        _camera = (Camera2D)GetNode("Camera2D");

        GUIManager.RegisterElement(this);
    }
Esempio n. 25
0
    // Use this for initialization
    void Start()
    {
        player    = GameObject.FindWithTag("Player");
        pc        = (PlayerControl)player.GetComponent("PlayerControl");
        cc        = (CameraControls)mainCamera.GetComponent("CameraControls");
        theReason = new GameObject();
        theReason.AddComponent <TextMesh>();
        TextMesh tm = theReason.GetComponent <TextMesh>();

        theReason.transform.position = new Vector3(text.transform.position.x, text.transform.position.y - 5, text.transform.position.z);
        tm.color     = Color.black;
        tm.anchor    = TextAnchor.MiddleCenter;
        tm.alignment = TextAlignment.Center;
        tm.fontSize  = text.GetComponent <TextMesh>().fontSize *3 / 4;
    }
Esempio n. 26
0
        private void BtnNew_Click(GameObject map)
        {
            Cancel();
            CameraControls cameraControls = new CameraControls(Camera.main);

            new Inventory();
            MapGenerator mapGenerator = new MapGenerator(map);

            new AI.Waypoint(map, canvas);
            new AI.Road(map, canvas);
            new Menu(map, canvas);
            AlertList alertList = new AlertList(canvas);

            AlertList.NewAlert("UI_ALERT_TEST", "mug", null);
        }
Esempio n. 27
0
        public static void Update()
        {
            GameKeyState.Update();
            GameMouseState.Update();

            if (CameraControls != null && !CameraControls.IsPaused)
            {
                CameraControls.Update();
            }

            if (PlayerControls != null && !PlayerControls.IsPaused)
            {
                PlayerControls.Update();
            }
        }
Esempio n. 28
0
 // Use this for initialization
 void Start()
 {
     originalPos = transform.position;
     if (original != null)
     {
         /*clone1 = Instantiate(original,transform) as GameObject;
          * clone1.transform.position = new Vector3(original.transform.position.x + original.transform.localScale.x, original.transform.position.y, original.transform.position.z);
          * clone2 = Instantiate(original, transform) as GameObject;
          * clone2.transform.position = new Vector3(original.transform.position.x, original.transform.position.y - original.transform.localScale.y, original.transform.position.z);
          * clone3 = Instantiate(original, transform) as GameObject;
          * clone3.transform.position = new Vector3(original.transform.position.x + original.transform.localScale.x, original.transform.position.y - original.transform.localScale.y, original.transform.position.z);*/
     }
     myCamera      = Camera.main.GetComponent <CameraControls>();
     lastCameraPos = Camera.main.transform.position;
 }
Esempio n. 29
0
    // Use this for initialization
    void Start()
    {
        // Initialize y base, y diff and thetaDiff to 0
        yBase            = 0;
        yDiff            = 0;
        thetaDiff        = 0;
        numRowsPopulated = 0;
        method           = 0; // Default Search method is using Application.DataPath
#if UNITY_ANDROID || UNITY_IOS || UNITY_WP8 || UNITY_IPHONE
        method = 1;           // Search method is using Application.persistentDataPath if on mobile
#endif
        numImages = 0;
        maxImages = 32;
        // Default display type is cylinder. This is overridden by the default in FolderSelectionManager
        loadType = 1;   // 0 - Spiral, 1 - cylinder
        // Get the base prefab gameobject from the resources folder
        imgFrameObject  = Resources.Load <GameObject>("Prefabs/ImageSpriteTemplate");
        arenaUnitObject = Resources.Load <GameObject>("Prefabs/BaseArenaUnit");
        imgLoader       = FindObjectOfType <FileLoader>();
        guiscpt         = FindObjectOfType <GUIscripts>();
        ic        = FindObjectOfType <inputControls>();
        cControls = FindObjectOfType <CameraControls>();

        // Check if we have a folderHolder. If yes, use the file information that it provides
        // to load images
        GameObject folderHolder;
        if ((folderHolder = GameObject.Find("folderHolder")) != null)
        {
            FolderSelectionManager fm = folderHolder.GetComponent <FolderSelectionManager>();
            fileInfos = fm.selectedFiles;
            loadType  = fm.loadType;
            unleashed = fm.isUnleashed;
            fm.farewell();
        }
        else
        {
            // Otherwise use the imageloader script to get files
            fileInfos = imgLoader.getDirInfo(method, "ImageFolder");    // Get the image directory info, using method
        }
        // Initial code calls placeImageFrames and cControls adjustement in sequence

        /*placeImageFrames();
         * cControls.adjustOsc(8, numRowsPopulated);*/
        // New code calls the same functions, along with calls to other scripts to initiate them once done, in a coroutine
        StartCoroutine(imagePlacementRoutine());
    }
Esempio n. 30
0
    public void Start()
    {
        if (!resourcesUrl.EndsWith("/"))
        {
            resourcesUrl += "/";
        }

        if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            Debug.Log("The full URL is: " + Application.absoluteURL);

            // Set scenario and map based on URL parameters

            Uri uri = new Uri(Application.absoluteURL);

            string scenarioArg = HttpUtility.ParseQueryString(uri.Query).Get("scenario");
            string mapArg      = HttpUtility.ParseQueryString(uri.Query).Get("map");

            if (scenarioArg == null || !int.TryParse(scenarioArg, out scenarioId))
            {
                scenarioId = 0;
            }
            if (mapArg == null || !int.TryParse(mapArg, out mapId))
            {
                mapId = 0;
            }
        }

        footageThumbnailsCache = new ImageLoaderCache(100);
        footagePhotosCache     = new ImageLoaderCache(25);
        cluesPhotosCache       = new ImageLoaderCache(25);

        mapObj = mapObjList[mapId];
        foreach (GameObject mo in mapObjList)
        {
            mo.SetActive(false);
        }
        mapObj.SetActive(true);

        map                 = mapObj.GetComponent <Map>();
        sceneCamera         = sceneCameraObj.GetComponent <Camera>();
        sceneCameraControls = sceneCameraObj.GetComponent <CameraControls>();
        timelineCamera      = timelineCameraObj.GetComponent <Camera>();

        startScreenText.text = scenarioNameList[scenarioId] + "\n" + startScreenText.text;
    }
Esempio n. 31
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindWithTag ("Player");
     mainCamera = (Camera)GameObject.FindWithTag("MainCamera").GetComponent<Camera>();
     pc = (PlayerControl)player.GetComponent<PlayerControl>();
     cc = (CameraControls)mainCamera.GetComponent("CameraControls");
     text = GameObject.FindGameObjectWithTag("GameOver");
     theReason =  new GameObject();
     theReason.AddComponent<TextMesh>();
     TextMesh tm = theReason.GetComponent<TextMesh>();
     theReason.transform.position = new Vector3(text.transform.position.x, text.transform.position.y - 5, text.transform.position.z);
     tm.color = Color.black;
     tm.anchor = TextAnchor.MiddleCenter;
     tm.alignment = TextAlignment.Center;
     tm.fontSize = text.GetComponent<TextMesh>().fontSize*3/4;
     pause = GameObject.FindGameObjectWithTag("Pause");
 }
Esempio n. 32
0
    void Awake()
    {
        /*
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            if (this != instance)
            {
                Destroy(this.gameObject);
            }
        }
         */

        Camera = GameObject.FindObjectOfType<CameraControls>();
        if (Camera == null)
        {
            Debug.Log("Cannot find camera on the current scene.");
        }

        Players = new List<Player>(GameObject.FindObjectsOfType<Player>());
        if (Players == null)
        {
            Debug.Log("Cannot find players on the current scene.");
        }
       Players.Reverse();

        //We need to sort players based on name....
        //IE, make the player named p1 go into index [0]
        //The players are grabbed kind of arbitrarily otherwise

        stage = GameObject.FindObjectOfType<Stage>();
        if (stage == null)
        {
            Debug.Log("Cannot locate stage");
        }
        spawnPoints = stage.spawnPoints;

        hit_boxes = GameObject.FindObjectsOfType<GameObject>().Where(x => x.GetComponent<Collider2D>() != null).ToArray();
    }
Esempio n. 33
0
    void OnEnable()
    {
        tooltipsEnabled = false;

        rotationScript    = rotationGizmo.GetComponent <RotationGizmo>();
        fuseEvent         = eventSystem.GetComponent <FuseEvent>();
        selectPart        = eventSystem.GetComponent <SelectPart>();
        cameraControls    = mainCam.GetComponent <CameraControls>();
        baseStartPosition = new Vector3(-100, 30, 100);

        fuseEvent.setIsFirstLevel(true);

        partButtons    = new Button[3];
        partButtons[0] = b1p1Button;
        partButtons[1] = b1p2Button;
        partButtons[2] = b1p3Button;

        // tooltips occur on: all part buttons, Fuse button, Finished Image, bb1 child
        allTooltips     = new Tooltip[16];
        allTooltips[0]  = b1p1Button.gameObject.GetComponent <Tooltip>();
        allTooltips[1]  = b1p2Button.gameObject.GetComponent <Tooltip>();
        allTooltips[2]  = b1p3Button.gameObject.GetComponent <Tooltip>();
        allTooltips[3]  = finishedImage.GetComponent <Tooltip>();
        allTooltips[4]  = fuseButton.gameObject.GetComponent <Tooltip>();
        allTooltips[5]  = bb1.GetComponent <Tooltip>();
        allTooltips[6]  = yUp.GetComponent <Tooltip>();
        allTooltips[7]  = yDown.GetComponent <Tooltip>();
        allTooltips[8]  = xUp.GetComponent <Tooltip>();
        allTooltips[9]  = xDown.GetComponent <Tooltip>();
        allTooltips[10] = zUp.GetComponent <Tooltip>();
        allTooltips[11] = zDown.GetComponent <Tooltip>();
        allTooltips[12] = bb1_b1p1_a1.GetComponent <Tooltip>();
        allTooltips[13] = bb1_b1p2_a1.GetComponent <Tooltip>();
        allTooltips[14] = bb1_b1p2_a2.GetComponent <Tooltip>();
        allTooltips[15] = bb1_b1p3_a1.GetComponent <Tooltip>();

        //make sure all tooltips are disabled on startup
        for (int i = 0; i < allTooltips.Length; i++)
        {
            allTooltips[i].enabled = false;
        }
    }
        public void Start()
        {
            im = GameManager.Instance.IM;

            myControls = new CameraControls();

            lastMousePos          = Vector3.zero;
            currentCameraDistance = minZoomDistance + ((maxZoomDistance - minZoomDistance) / 2.0f);
            wantedCameraDistance  = currentCameraDistance;

            terrain = GameManager.Instance.currentMainHandler.terrainHandler.MyTerrain;

            if (terrain != null)
            {
                cameraTarget = transform.position;
            }
            else
            {
                cameraTarget = transform.position;
            }
        }
Esempio n. 35
0
 // Use this for initialization
 void Start()
 {
     sceneBounds = transform.Find("sceneBounds").GetComponent <BoxCollider2D>();
     myCamera    = Camera.main.transform.GetComponent <CameraControls>();
     if (_hasDialogue)
     {
         dialogueJSON = Resources.Load(Path.Combine("Dialogue JSON", _dialogueFile)) as TextAsset;
         myDialogue   = new DialogueList();
         string json = dialogueJSON.text;
         myDialogue = JsonUtility.FromJson <DialogueList>(json);
         foreach (Dialogue element in myDialogue.dialogues)
         {
             Debug.Log(element.name + ": " + element.line);
         }
     }
     mainObject      = GameObject.Find("Main").transform;
     player          = GameObject.Find("player").GetComponent <Player>();
     dialogueGO      = GameObject.Find("Dialogue").transform.Find("Text").GetComponent <Text>();
     dialogueGroup   = GameObject.Find("Dialogue").GetComponent <CanvasGroup>();
     playedFromStart = _playOnStart;
 }
Esempio n. 36
0
    void Start()
    {
        overlay = new DetailsOverlay(baseDir);
        overlay.CloseInfo += () => {showOverlay = false;};

        cameraControls = new CameraControls(baseDir);
        cameraControls.TakeScreenShot += () => TakeScreenShot();

        upperMenu = new UpperMenu(baseDir);
        upperMenu.CancelDelete += () => CancelDeleteFn();
        upperMenu.DeleteBtn += () => DeleteButtonFn();
        upperMenu.searchClick += () => searchClickHandler();
        upperMenu.ClearBtn += () => {ClearBtn(); ResetManipulation();};
        upperMenu.InfoClick += () => InfoClick();
        upperMenu.textChange += (newText) => setSearchText(newText);

        sideMenu = new SideMenu(baseDir);
        sideMenu.SpawnFurniture += (furniture) => spawnFurniture(furniture);
        sideMenu.ShowInfo += (furniture) => showInfo(furniture);
        sideMenu.CategoryClick += () => {upperMenu.resetSearchBar();};

        SSLogoTex = (Texture2D)Resources.Load(baseDir + "Screenshot/SNAPSHOT_cornerlogo_02");
    }
Esempio n. 37
0
    /// <summary>
    /// This should be called exactly once before actually running a puzzle.
    /// This will initialize all variables needed by the puzzle.
    /// Only put code that can execute in 1 frame here.
    /// </summary>
    override public void Setup()
    {
        status = PuzzleStatus.INPROGRESS;

        timeRemaining = timeLimit;
        cam1 = GameObject.Find("P1 Camera").GetComponent<CameraControls>();
        cam1.Target(fallingPlayer.GetTarget());
        oldCam1Size = cam1.GetComponent<Camera>().orthographicSize;
        cam1.GetComponent<Camera>().orthographicSize = cameraSize;
        cam2 = GameObject.Find("P2 Camera").GetComponent<CameraControls>();
        cam2.Target(fallingPlayer.GetTarget());
        oldCam2Size = cam2.GetComponent<Camera>().orthographicSize;
        cam2.GetComponent<Camera>().orthographicSize = cameraSize;

        catcherBounds = catcher.GetComponent<Collider2D>();
        if(fallingPlayer.assignment == FallerPlayer.PlayerAssignment.P1)
        {
            catcher.GetComponentInChildren<SpriteRenderer>().color = fallingPlayer.P2Color;
        }
        else
        {
            catcher.GetComponentInChildren<SpriteRenderer>().color = fallingPlayer.P1Color;
        }
        float newX = catcher.transform.position.x + Random.Range(-CATCHER_RADIUS, CATCHER_RADIUS);
        catcher.transform.position = new Vector3(newX, catcher.transform.position.y);
    }
Esempio n. 38
0
 // Use this for initialization
 void Awake()
 {
     s = PauseCam.GetComponent<SmoothCam>();
     //up = UP.GetComponent<UP>();
     //down = DOWN.GetComponent<DOWN>();
     //left = LEFT.GetComponent<LEFT>();
     //right = RIGHT.GetComponent<RIGHT>();
     XSen = PlayerPrefs.GetFloat("XSen", 8);
     YSen = PlayerPrefs.GetFloat("YSen", 8);
     ZSen = PlayerPrefs.GetFloat("ZSen", 15) * 10;
     ZoomIn = PlayerPrefs.GetInt("ZoomIN", (int)KeyCode.Q);
     ZoomOut = PlayerPrefs.GetInt("ZoomOUT", (int)KeyCode.E);
     CamSpeed = ((XSen * YSen)/2)*CameraSpeed;
     DebugConsole.Log("CamSpeed: " + CamSpeed);
     inst = this;
 }
Esempio n. 39
0
 // Use this for initialization
 void Start()
 {
     cameraControls = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraControls>();
 }
Esempio n. 40
0
    void Awake()
    {
        highlight = GameObject.FindWithTag("Highlight").GetComponent<Highlight>();
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraControls>();
        gameInstance = this;
        gui = new UI();
        gui.Initialize();

        buildables = GetComponent<BuildableRegistry>(); //must be before state, because state references this in initialization
        state = new PlayerState();
    }
Esempio n. 41
0
    void Awake()
    {
        highlight = GameObject.FindWithTag("Highlight").GetComponent<Highlight>();
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraControls>();
        gameInstance = this;
        gui = new UI();
        gui.Initialize();

        state = new PlayerState();
    }