상속: MonoBehaviour
예제 #1
0
    void Start()
    {
        trailRenderer = GameObject.FindWithTag("TrailRenderer").GetComponent <TrailRenderer>();
        //trailRenderer.sortingLayerName = "Player";
        //parallax = GameObject.FindWithTag("Parallax").GetComponent<FreeParallax>();
        //particleSystem.GetComponent<ParticleSystem>().enableEmission = false;
        controller          = GetComponent <Controller2D> ();
        plungerScript       = GameObject.FindWithTag("Platform").GetComponent <PlungerScript>();
        cameraFollowScript  = GameObject.FindWithTag("MainCamera").GetComponent <CameraFollowSimple>();
        pauseMenuScript     = GameObject.FindWithTag("MainCamera").GetComponent <PauseMenuScript>();
        dieMenu             = GameObject.FindWithTag("Die Menu Canvas");
        previousButton      = GameObject.FindWithTag("Previous Button").GetComponent <Button>();
        nextButton          = GameObject.FindWithTag("Next Button").GetComponent <Button>();
        previousButtonImage = GameObject.FindWithTag("Previous Button Image").GetComponent <Image>();
        nextButtonImage     = GameObject.FindWithTag("Next Button Image").GetComponent <Image>();
        gravity             = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        jumpVelocity        = Mathf.Abs(gravity) * timeToJumpApex;
        currentScene        = SceneManager.GetActiveScene();
        boxCollider         = GetComponent <BoxCollider2D>();
        CoinDisplay         = GameObject.FindWithTag("Coin Counter").GetComponent <Text>();

        if (currentScene.name == "Dense Level" || currentScene.name == "Dense Level Hard")
        {
            CoinDisplay.text = "" + coinCounter.ToString("f0") + "/30";
        }
        else
        {
            CoinDisplay.text = "" + coinCounter.ToString("f0") + "/23";
        }
    }
예제 #2
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    void Start()
    {
        this.mainCamera.gameObject.SetActive(false);
        this.fileString = Application.persistentDataPath + "/sleepwalkerInfo.data";
        this.newGame    = MenuScript.newGame;      //get the boolean value from menu wether start new game or load old one.
        Debug.Log("Is game new game?" + this.newGame);
        this.sleepwalker   = GameObject.Find("Sleepwalker").GetComponent <SleepwalkerBehavior> ();
        this.homeTransform = GameObject.Find("Home").GetComponent <Transform> ();
        this.prefabloader  = new Prefabloader();

        if (!this.newGame)
        {
            this.Load();
        }



        this.pauseScript = GameObject.Find("PauseMenuCanvas").GetComponent <PauseMenuScript> ();
        this.up          = GameObject.Find("UpButton").GetComponent <ButtonScript> ();
        this.left        = GameObject.Find("LeftButton").GetComponent <ButtonScript> ();
        this.right       = GameObject.Find("RightButton").GetComponent <ButtonScript> ();
        this.down        = GameObject.Find("DownButton").GetComponent <ButtonScript> ();
        this.pauseButton = GameObject.Find("PauseButton").GetComponent <Button> ();
        this.pauseButton.onClick.AddListener(() => pause());
        this.scoreText  = GameObject.Find("ScoreText").GetComponent <Text> ();
        this.healthText = GameObject.Find("HealthText").GetComponent <Text> ();
        this.levelText  = GameObject.Find("LevelText").GetComponent <Text> ();
        this.movement   = 0.2f;
        this.gamePaused = false;
        this.updatePlayerInfo();
        this.newLevel(this.currentLevel);
    }
    // Use this for initialization
    void Start()
    {
        pms      = canvas.GetComponent <PauseMenuScript> ();
        leftMax  = 300f;
        rightMax = 270f;

        // at the start of the game spawn all the characters in the leftBank at their respective position
        Transform leftRiverBank = charPosition.GetChild(0);

        // now spawn missionary for first 3 children of leftRiverBank and next 3 children with cannibal
        // spawn missionary
        for (int i = 0; i < 3; i++)
        {
            Instantiate(charTransform [0], leftRiverBank.GetChild(i).position, Quaternion.identity, leftRiverBank.GetChild(i));
        }

        // sqawn cannibal
        for (int i = 3; i < 6; i++)
        {
            Instantiate(charTransform [1], leftRiverBank.GetChild(i).position, Quaternion.identity, leftRiverBank.GetChild(i));
        }

        boat       = charPosition.GetChild(1);
        boatScript = boat.GetComponent <BoatController> ();
    }
예제 #4
0
 void Awake()
 {
     isMultiplayer        = Scenes.getParam("multiplayer") == "true";
     buildingSystemScript = BuildingSystem.instance;
     inventoryScript      = Inventory.instance;
     pauseMenuScript      = PauseMenuScript.instance;
     chatClientScript     = ChatClient.instance;
 }
예제 #5
0
 void Start()
 {
     instance = this;
     this.enabled = false;	// The game can enable this script when the game is paused
     GameObject player = GameObject.FindWithTag("Player");
     characterScript = player.GetComponent<CharacterScript>();
     optionsScript = transform.parent.GetComponentInChildren<OptionsScript>();
 }
예제 #6
0
    private void initScreens()
    {
        CharacterScreen = this.gameObject;
        InfoScreen      = GameObject.FindGameObjectWithTag("PauseMenu");
        EquipmentScreen = GameObject.FindGameObjectWithTag("EquipPanel");

        equipmentScreenController = EquipmentScreen.GetComponent <EquipmentControllerScript>();
        pauseScreenController     = InfoScreen.GetComponent <PauseMenuScript>();
    }
예제 #7
0
    private void Start()
    {
        _pauseMenuScript = GameManager.CameraObject.GetComponentInChildren <PauseMenuScript>();

        if (_pauseMenuScript != null)
        {
            _pauseMenuScript.PauseState += Paused;
        }
    }
    public void StopShowcase()
    {
        showcase          = false;
        simulationStarted = false;

        //Specimen = null;

        PauseMenuScript pauseScript = GameObject.Find("Menu Canvas").GetComponent <PauseMenuScript>();

        pauseScript.RestartSimulation();
    }
예제 #9
0
    private void Awake()
    {
        PMS               = FindObjectOfType <PauseMenuScript>();
        PMS.PauseState   += InputBlock;
        _waitBetweenFlare = new Timer(_minTimeBetweenFlares, _minTimeBetweenFlares);

        thisRigidbody      = GetComponent <Rigidbody2D>();
        _currentFlareCount = _maxAmountFlares;

        _floorMask = LayerMask.GetMask(Layers.CLICKABLE);
    }
예제 #10
0
 void Update()
 {
     if (Input.GetKey(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P))
     {
         //pause the game
         Time.timeScale = 0.0f;
         //show the pause menu
         PauseMenuScript pauseScript = gameObject.GetComponent <PauseMenuScript>();
         pauseScript.enabled = true;
         //disable the cursor
         Cursor.visible = false;
     }
 }
예제 #11
0
 private void playFrogSound()
 {
     Debug.Log("Before ifs the frogSoundOn is : " + frogSoundOn);
     if (PauseMenuScript.checkIfGamePaused() && frogSoundOn)
     {
         frogSound.Pause();
         frogSoundOn = false;
         Debug.Log("To pause: " + frogSoundOn);
     }
     else if (!PauseMenuScript.checkIfGamePaused() && !frogSoundOn)
     {
         frogSound.Play();
         frogSoundOn = true;
         Debug.Log("To play");
     }
 }
    void Start()
    {
        _positionHandler  = GetComponent <PositionHandlerScript>();
        _controllers      = _positionHandler.Controllers;
        _playerPositions  = _positionHandler.PlayerPositions;
        _defaultPositions = _positionHandler.DefaultPositions;
        _carRigidbody     = GetComponent <Rigidbody>();
        _respawnScript    = GetComponent <RespawnScript>();

        _countDownScript = Countdown.GetComponent <CountDown>();

        _maxSpeed = _maxSpeedDefault;

        _canvas    = GameObject.Find("Canvas").transform;
        _pauseMenu = _canvas.GetComponent <PauseMenuScript>();
    }
 private void Awake()
 {
     _lineRenderer = GetComponent <LineRenderer>();
     //_soundIndicatorCapture = GetComponentInChildren<Camera>();
     _playerGUIScript = FindObjectOfType <PlayerGUIScript>();
     _playerGUIScript.NoiseAmmountChange += OnNoiseChange;
     _pauseMenuScript             = FindObjectOfType <PauseMenuScript>();
     _pauseMenuScript.PauseState += OnPause;
     _lineRenderer.positionCount  = _numberOfLineSegments;
     _oldLineCount = _numberOfLineSegments;
     _lineWidth    = _lineRenderer.widthMultiplier;
     _lineRenderer.widthMultiplier = 0;
     GenerateLineData();
     _lineUpdate = LineRender();
     //_colourUpdateFraction = Mathf.InverseLerp(0, MAX_GRADIENT_INDEX, 1);
 }
예제 #14
0
 void Start()
 {
     C  = GameObject.FindGameObjectWithTag("Bird").GetComponent <Character>();
     PM = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <PauseMenuScript>();
     SS = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SoundScript>();
     AD = GameObject.FindGameObjectWithTag("Admob").GetComponent <AdManager>();
     GameOver.SetActive(false);
     Time.timeScale = 1;
     PM.PlayButton.SetActive(true);
     LastScore = PlayerPrefs.GetInt("LastScore");
     HighScore = PlayerPrefs.GetInt("HighScore");
     GameMusic.Play();
     if (PlayerPrefs.GetString("Sound") == "false")
     {
         GameMusic.Stop();
     }
 }
예제 #15
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         DestroyObject(gameObject);
     }
     DontDestroyOnLoad(this);
     children = new GameObject[transform.childCount];
     for (int i = 0; i < transform.childCount; i++)
     {
         children[i] = transform.GetChild(i).gameObject;
         children[i].SetActive(false);
     }
 }
 public void ReadyToGoAuto()
 {
     if (auto_btn_clicked == false)
     {
         auto_btn_clicked = true;
         Transform leftBank = gameControllerScript.charPosition.GetChild(0);
         for (int i = 0; i < 6; i++)
         {
             if (leftBank.GetChild(i).childCount == 0)
             {
                 auto_play_enabled = false;
                 auto_btn_clicked  = false;
                 PauseMenuScript ps = canvas.GetComponent <PauseMenuScript> ();
                 ps.ShowAutoPlayMenu();
                 return;
             }
         }
         AutoSolve();
     }
 }
예제 #17
0
    private void Start()
    {
        currentScene     = SceneManager.GetActiveScene().name;
        healthController = healthControllerContainer.GetComponent <HealthController>();
        moneySystem      = moneySystemContainer.GetComponent <MoneySystem>();
        questManager     = questContainer.GetComponent <QuestManager>();
        menu             = menuContainer.GetComponent <PauseMenuScript>();
        blacksmith       = blacksmithContainer.GetComponent <BlacksmithController>();

        if (SaveWorker.SaveExists() && PlayerPrefs.GetString("newGame") == "false")
        {
            Load();
        }
        if (currentScene == "FirstScene")
        {
            PlayerPrefs.SetString("newGame", "false");
        }

        Save();
    }
예제 #18
0
    private void Start()
    {
        _fadeHandler = FindObjectOfType <FadeHandler>();
        if (_fadeHandler == null)
        {
            Debug.LogWarning("The GameManager could not find any object that has a FadeHandler");
        }
        else
        {
            _fadeHandler.FadeEnded += BeginningFadeDone;
            _fadeHandler.StartFadeIn();
            if (FadeEvent != null)
            {
                FadeEvent(true);
            }
        }

        _mainMusicParent = FindObjectOfType <MainMusicParent>();
        if (_mainMusicParent == null)
        {
            Debug.LogWarning("The GameManager could not find any object that has a MainMusicParent");
        }


        if (_mainMusicParent == null)
        {
            Debug.LogWarning("The GameManager did not have any GameOverStingerHandler");
        }
        else
        {
            _gameOverStinger = _mainMusicParent.gameObject.GetComponentInChildren <GameOverStingerHandler>();
        }

        if (_camera != null)
        {
            _pauseMenuScript = _camera.GetComponentInChildren <PauseMenuScript>();
        }
    }
예제 #19
0
    // Start is called before the first frame update
    void Start()
    {
        savePath = Application.dataPath + "/savedata.json";

        rb2d               = GetComponent <Rigidbody2D>();
        anim               = GetComponent <Animator>();
        isColliding        = false;
        plowedGround       = Resources.Load <GameObject>("Prefabs/PlowedGround_Dry");
        moneyScript        = GameObject.Find("MoneyAmount").GetComponent <MoneyScript>();
        equippedItemScript = GameObject.Find("ItemBackground").GetComponent <EquippedItemScript>();
        pauseMenuScript    = GameObject.Find("GameUI").GetComponent <PauseMenuScript>();

        currentlyEquipped = "none";

        money = 100;

        equippedItemScript.EmptyEquippedItem();

        LoadData();
        Debug.Log("Game Loaded");

        moneyScript.UpdateMoneyText(money);
    }
 void Start()
 {
     aftercountdown = 1.2f;
     firstGUI = true;
     guin = GetComponent<GUINavigation>();
     pms = GetComponent<PauseMenuScript>();
 }
예제 #21
0
    private void InitPauseMenu()
    {
        //If current scene is in MainLevel_PabloCamacho
        if (SceneManager.GetActiveScene().name == "MainLevel_PabloCamacho")
        {
            //get array of root game objects in Scene MainLevel_PabloCamacho
            GameObject[] rootGameObjectsOfMainLevelScene = SceneManager.GetSceneByName("MainLevel_PabloCamacho").GetRootGameObjects();

            //Go through all elements in root game objects array
            for (int i = 0; i < rootGameObjectsOfMainLevelScene.Length; i++)
            {
                //Debug.Log(i + " game object in Main Level is " + rootGameObjectsOfMainLevelScene[i]);

                //if root game object has tag PauseMenuCanvas
                if (rootGameObjectsOfMainLevelScene[i].tag == "PauseMenuCanvas")
                {
                    //assign pauseMenuCanvas to canvas component of this root game object
                    pauseMenuCanvas = rootGameObjectsOfMainLevelScene[i].GetComponent <Canvas>();

                    //assign reference to this pause game script to PauseMenuScript
                    PauseMenuScript thisPauseMenuScript = pauseMenuCanvas.GetComponentInChildren <PauseMenuScript>();
                    thisPauseMenuScript.pauseGameScriptRef = transform.root.GetComponentInChildren <PauseGame>();
                    //assign reference to pause menu script
                    pauseMenuScriptRef = thisPauseMenuScript;

                    if (pauseMenuCanvas != null)
                    {
                        break;
                    }                                                              //stop loop
                }
            }
        }
        //else if current scene is in MainLevel
        else if (SceneManager.GetActiveScene().name == "MainLevel")
        {
            //get array of root game objects in Scene MainLevel
            GameObject[] rootGameObjectsOfMainLevelScene = SceneManager.GetSceneByName("MainLevel").GetRootGameObjects();

            //Go through all elements in root game objects array
            for (int i = 0; i < rootGameObjectsOfMainLevelScene.Length; i++)
            {
                //Debug.Log(i + " game object in Main Level is " + rootGameObjectsOfMainLevelScene[i]);

                //if root game object has tag PauseMenuCanvas
                if (rootGameObjectsOfMainLevelScene[i].tag == "PauseMenuCanvas")
                {
                    //assign pauseMenuCanvas to canvas component of this root game object
                    pauseMenuCanvas = rootGameObjectsOfMainLevelScene[i].GetComponent <Canvas>();

                    //assign reference to this pause game script to PauseMenuScript
                    PauseMenuScript thisPauseMenuScript = pauseMenuCanvas.GetComponentInChildren <PauseMenuScript>();
                    thisPauseMenuScript.pauseGameScriptRef = transform.root.GetComponentInChildren <PauseGame>();
                    //assign reference to pause menu script
                    pauseMenuScriptRef = thisPauseMenuScript;

                    if (pauseMenuCanvas != null)
                    {
                        break;
                    }                                                              //stop loop
                }
            }
        }
    }
예제 #22
0
    // Use this for initialization
    void Start()
    {
        this.enabled = false;

        pauseMenu = transform.parent.GetComponentInChildren<PauseMenuScript>();
    }
예제 #23
0
 void Start()
 {
     PauseScript = gameObject.GetComponent <PauseMenuScript>();
 }
예제 #24
0
 // Use this for initialization
 void Start()
 {
     musicPlayer = music.GetComponent <MusicPlayerScript> ();
     UI          = UIContainer.GetComponent <PauseMenuScript>();
 }
예제 #25
0
 void Start()
 {
     loadInfo    = LoadInfo.Instance;
     pauseScript = loadInfo.pauseController;
     invScript   = InventoryScript.Instance;
 }
예제 #26
0
 public void FindGameObjects() {
     vendingMachine = FindObjectOfType<VendingMachine>();
     pauseMenu = GameObject.Find("PauseMenuManager").GetComponent<PauseMenuScript>();
     coverSpots = FindObjectsOfType<CoverSpotScript>();
     weaponManager = FindObjectOfType<WeaponManager>();
 }
예제 #27
0
    private void initScreens()
    {
        CharacterScreen = this.gameObject;
        InfoScreen = GameObject.FindGameObjectWithTag("PauseMenu");
        EquipmentScreen = GameObject.FindGameObjectWithTag("EquipPanel");

        equipmentScreenController = EquipmentScreen.GetComponent<EquipmentControllerScript>();
        pauseScreenController = InfoScreen.GetComponent<PauseMenuScript>();
    }
예제 #28
0
    void Start()
    {
        networkManager = GetComponent<NetworkManagerScript>();
        mainMenu = GetComponent<MainMenuScript>();
        pause = GetComponent<PauseMenuScript>();
        scoreMenu = GetComponent<ScoreMenuScript>();
        chatRoom = GetComponent<ChatRoomScript>();
        chatBoxColor = new Color(1,1,1,GameSettings.chatBoxOpacity);

        chatRect = new Rect(0, 100, 300, 400);
    }
예제 #29
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (pauseMenuActive)
            {
                ClosePauseMenu();
            }
            else
            {
                OpenPauseMenu();
            }

            if (pauseMenuScript == null)
            {
                pauseMenuScript = PauseMenuScript.instance;
                if (pauseMenuScript == null)
                {
                    Debug.LogWarning("couldn't get pauseMenuScript instance!");
                }
            }
            pauseMenuScript.TogglePauseMenu();
        }
        if (pauseMenuActive)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.Delete))
        {
            if (chatMenuActive)
            {
                CloseChatMenu();
            }
            else
            {
                OpenChatMenu();
            }
            if (chatClientScript == null)
            {
                chatClientScript = ChatClient.instance;
                if (chatClientScript == null)
                {
                    Debug.LogWarning("couldn't get chatClientScript instance!");
                }
            }
            chatClientScript.ToggleChatMenu();
            return;
        }



        if (oSD.activeSelf)
        {
            if (Input.GetKeyDown("t"))
            {
                if (buildingSystemScript == null)
                {
                    buildingSystemScript = BuildingSystem.instance;
                    if (buildingSystemScript == null)
                    {
                        Debug.LogWarning("couldn't get buildingSystemScript instance!");
                    }
                }
                buildingSystemScript.ToggleEditMode();
                return;
            }
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                if (inventoryScript == null)
                {
                    inventoryScript = Inventory.instance;
                    if (inventoryScript == null)
                    {
                        Debug.LogWarning("couldn't get inventory instance!");
                    }
                }
                inventoryScript.ToggleInventory();
                return;
            }
        }
    }
예제 #30
0
    public void Unlock()
    {
        PauseMenuScript pauseController = LoadInfo.Instance.pauseController;
        CharacterScript charScript      = pauseController.selectedCharacter.GetComponent <CharacterScript>();
        Trait           trait           = null;

        for (int n = 0; n < traits.Count; n++)
        {
            if (!charScript.unlockedTraits.Contains(traits[n]))
            {
                trait = traits[n];
                Debug.Log("Chose trait!");
                break;
            }
            else
            {
                Debug.Log("Not choosing " + traits[n].name);
            }
        }

        if (trait == null)
        {
            Debug.LogError("Can't unlock");
            return;
        }

        if (charScript.unlockPoints >= trait.unlockPoints)
        {
            charScript.unlockedTraits.Add(trait);
            charScript.unlockPoints -= trait.unlockPoints;
            Debug.Log("Unlocking " + trait.name);

            if (trait.statNum != 0)
            {
                switch (trait.stat)
                {
                case Trait.Stat.Health:

                    charScript.baseMaxHealth += trait.statNum;
                    break;

                case Trait.Stat.Magic:

                    charScript.baseMaxMagic += trait.statNum;
                    break;

                case Trait.Stat.Strength:

                    charScript.baseStrength += trait.statNum;
                    break;

                case Trait.Stat.intelligence:

                    charScript.baseIntelligence += trait.statNum;
                    break;

                case Trait.Stat.Resistance:

                    charScript.baseResistance += trait.statNum;
                    break;

                case Trait.Stat.Spirit:

                    charScript.baseSpirit += trait.statNum;
                    break;

                case Trait.Stat.Persistance:

                    charScript.basePersistance += trait.statNum;
                    break;

                case Trait.Stat.Immunity:

                    charScript.baseImmunity += trait.statNum;
                    break;

                case Trait.Stat.Speed:

                    charScript.baseSpeed += trait.statNum;
                    break;

                case Trait.Stat.Luck:

                    charScript.baseImmunity += trait.statNum;
                    break;
                }
            }
        }
        else
        {
            Debug.LogError("Not enough points to unlock!");
        }
    }
 void Start()
 {
     _canvas    = GameObject.Find("Canvas").transform;
     _pauseMenu = _canvas.GetComponent <PauseMenuScript>();
 }
예제 #32
0
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
     Resume();
 }
예제 #33
0
 void Start()
 {
     networkManager = GetComponent<NetworkManagerScript>();
     mainMenu = GetComponent<MainMenuScript>();
     hud = GetComponent<HUDScript>();
     pause = GetComponent<PauseMenuScript>();
 }
예제 #34
0
 void Awake()
 {
     _instance = this;
 }
예제 #35
0
 void Awake()
 {
     Instance = this;
 }