Esempio n. 1
0
	void Awake ()
	{
		onFire = false;
		announcerAudio = GetComponents<AudioSource> () [1];
		playerAttack = GetComponent<PlayerAttack> ();

		canvas = GameObject.Find ("HUDCanvas");
		//Debug.Log ("PlayerHealthUI_" + playerAttack.playerNum);

		inGameHealthUI = canvas.GetComponent<RectTransform> ().Find ("PlayerHealthUI_" + playerAttack.playerNum)
			.GetComponent<InGameHealthUI>();
		inGameHealthUI.playerHealth = this;
		rigid = GetComponent<Rigidbody> ();
		gm = GameObject.Find ("GameManager").GetComponent<GameManager> ();
		uim = GameObject.Find ("GameManager").GetComponent<UI_Manager> ();
		joystickNum = playerAttack.joystickNum;
		damageReduction = 1;
		allgrounds = GameObject.FindGameObjectsWithTag("Island");
		anim = GetComponent <Animation> ();
		playerAudio = GetComponent <AudioSource> ();
		playerMovement = GetComponent <PlayerMovement> ();

		//playerShooting = GetComponentInChildren <PlayerShooting> ();
		currentHealth = startingHealth;
		SetupHealthUI ();
	}
Esempio n. 2
0
 void Awake()
 {
     _instance = this;
     UI_Datas = new Dictionary<string, UI_Base>();
     for (int i = 0; i < UI.Count; i++)
     {
         UI_Datas.Add(UI[i].gameObject.name, UI[i]);
     }
 }
Esempio n. 3
0
    public void Damage()
    {
        if (isshieldactive == true)
        {
            isshieldactive = false;

            ShieldVisuals.SetActive(false);


            return;
        }



        _lives--;

        if (_lives == 2)
        {
            Left_engine.SetActive(true);
        }

        else if (_lives == 1)
        {
            Right_engine.SetActive(true);
        }

        UI = GameObject.Find("Canvas").GetComponent <UI_Manager>();

        UI.UpdateLives(_lives);


        spawn = GameObject.Find("Spawn").GetComponent <Spawn>();



        if (_lives < 1)
        {
            spawn.OnPlayerDeath();

            UI.checkforbestscore();

            Destroy(this.gameObject);
        }
    }
    void Start()
    {
        //coinCountImage.SetActive(true);
        //feetCountImage.SetActive(true);

        gameManager.SetActive(false);

        GameObject UIManagerObject = GameObject.FindWithTag("UIManager");

        UIManager = UIManagerObject.GetComponent <UI_Manager>();

        distanceRunDividedBy = 10;
        playerHasRun         = 0;
        distance             = 0;
        currentBalance       = PlayerPrefs.GetInt("currencyPref");
        isRifleSold          = PlayerPrefs.GetInt("IsRifleSold");

        if (isRifleSold == 1)
        {
            rifle.SetActive(true);
        }
        else
        {
            rifle.SetActive(false);
        }

        currencyBalance.text = currentBalance.ToString();

        highScoreText.text = /*"Hiscore: " + */ PlayerPrefs.GetInt("HighScore", 0).ToString();

        newHighScoreText.text = "";

        playerHasRun = 0;
        UpdateScore();

        running            = true;
        coinCountText.text = "0";
        feetCountText.text = "0";

        foreach (GameObject hazard in hazards)
        {
            hazard.gameObject.GetComponent <OnCollision>().speed = 32f;
        }
    }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        rb           = gameObject.GetComponent <Rigidbody2D>(); //this is new
        _sceneswitch = GetComponent <SceneSwitch>();
        _audioSource = GetComponent <AudioSource>();

        _uimanager = GameObject.Find("Canvas_Game").GetComponent <UI_Manager>();

        has_magnet = false;

        TimeScript.timeValue = 80.0f;


        transform.position = new Vector3(-8.806f, -0.652f, 0);



        Instantiate(_Jump_PowerUp_Object, new Vector3(80.903f, -1.6314f, 0), Quaternion.identity);
    }
Esempio n. 6
0
    void Awake()
    {
        /* Singleton Shit */
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        /* Actual Shit */
        UI_Manager  = GetComponent <UI_Manager>();
        Keypad      = KeypadObject.GetComponent <Keypad>();
        LineManager = LineManagerObj.GetComponent <LineManager>();
        Scrambler   = ScramblerObj.GetComponent <Scrambler>();
    }
Esempio n. 7
0
    void Start()
    {
        _animController = gameObject.GetComponent <Animator>();
        _gameManager    = GameObject.Find("Game_Manager").GetComponent <GameManager>();
        if (!_gameManager.isCoop)
        {
            transform.position = new Vector3(0, 0, 0);
        }
        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();
        if (_spawnManager == null)
        {
            Debug.Log("The spawn manager is NULL");
        }

        _uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>();
        if (_uiManager == null)
        {
            Debug.Log("UI manager is NULL");
        }
    }
Esempio n. 8
0
    void Start()
    {
        _randomEngineDamage = Random.Range(0, 2);

        uiManager    = GameObject.Find("Canvas").GetComponent <UI_Manager>();
        gameManager  = GameObject.Find("GameManager").GetComponent <GameManager>();
        spawnManager = GameObject.Find("SpawnManager").GetComponent <SpawnManager>();
        _laserShoot  = GetComponent <AudioSource>();
        if (uiManager != null)
        {
            uiManager.UpdateLives(lifePoints);
            uiManager.UpdateLivesP2(lifePointsP2);
        }
        SingleOrCoop(gameManager.CheckGameMode());
        spawnManager.startMyGame();
        hitCount = 0;

        lifePoints   = 3;
        lifePointsP2 = 3;
    }
Esempio n. 9
0
 public void Init(Table t)
 {
     table  = t;
     player = table.player;
     pc     = table.pc;
     //load deck
     BuidDeck();
     //set up first 4 cards
     setTable();
     //initialize player and pc and pass table reference
     player.INIT(t);
     pc.INIT(t);
     //assign card to players
     giveCardToPlayers();
     deckImage     = GameObject.Find("deckImage").GetComponent <Image>();
     score_manager = FindObjectOfType <ScoreManager>();
     cardEnded     = false;
     ui            = FindObjectOfType <UI_Manager>();
     ui.INIT();
 }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        //player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehaviour>();
        ui = GameObject.FindGameObjectWithTag("UI").GetComponent <UI_Manager>();

        rend = gameObject.GetComponent <Renderer>();
        int rand = Random.Range(0, 2);

        if (rand == 1)
        {
            //Cambio Color
            rend.material = material_1;
            parrileable   = true;
        }
        else
        {
            rend.material = material_2;
            parrileable   = false;
        }
    }
Esempio n. 11
0
    void Start()
    {
        _fireRate = _defaultFireRate;

        // Turn off all effects
        _shieldVisualizer.SetActive(false);
        _damageLeft.SetActive(false);
        _damageRight.SetActive(false);

        // Position our ship in the middle of the screen
        transform.position = new Vector3(0, 0, 0);

        // Get access to the spawn manager
        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();
        Debug.Assert(_spawnManager, "Player cant find Spawn Manager");

        // Get access to the game manager
        _uiManager = GameObject.Find("UI_Manager").GetComponent <UI_Manager>();
        Debug.Assert(_uiManager, "Player cant find UI Manager");
    }
Esempio n. 12
0
    // Use this for initialization
    void Start()
    {
        //get the ui manager component
        _UIManager = GameObject.Find("Canvas").GetComponent <UI_Manager>();

        //update the lives counter according to the player lives
        _UIManager.UpdateLives(playerLives);

        //get the spawn manager component
        _spawnManager = GameObject.Find("Spawn Manager").GetComponent <Spawn_Manager>();

        //get the audio source
        _laserSound = GetComponent <AudioSource>();

        //run the spawning coroutines after a nullcheck
        if (_spawnManager != null)
        {
            _spawnManager.StartSpawnRoutines();
        }
    }
Esempio n. 13
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         if (Input.GetKeyDown(KeyCode.E))
         {
             Player player = other.GetComponent <Player>();
             if (player != null)
             {
                 player._hasCoin = true;
                 AudioSource.PlayClipAtPoint(_pickup, transform.position, 0.5f);
                 UI_Manager uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>();
                 if (uiManager != null)
                 {
                     uiManager.GotCoin();
                 }
                 Destroy(this.gameObject);
             }
         }
     }
 }
Esempio n. 14
0
    void Start()
    {
        Debug.Log("Game Has Started");

        spawn_manager = GameObject.Find("spawn_manager").GetComponent <spawn_manager>();

        wave = GameObject.Find("wave").GetComponent <Wave>();

        UI_Manager = GameObject.Find("Canvas").GetComponent <UI_Manager>();

        if (spawn_manager == null)
        {
            Debug.LogError("Spawn Manager Not Found");
        }


        if (UI_Manager == null)
        {
            Debug.LogError("UI Canvas Not Found");
        }
    }
Esempio n. 15
0
    void Start()
    {
        waterEnergy = waterEnergyMax;
        dirtMax     = waterEnergyMax;

        //for (int x = 0; x < 3; x++) playerSprite[x] = transform.GetChild(x).GetComponent<SpriteRenderer>();
        //for (int x = 0; x < 3; x++) Oka[x] = transform.GetChild(x).gameObject;
        isEnergyUsing = GameObject.Find("UI_Canvas") != null;

        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        dirtyRippeMat = this.transform.Find("DirtyRipple_Mask").Find("DirtyRipple").GetComponent <SpriteRenderer>().material;
        dirtyRippeMat.SetFloat("_drityDegree", 0);

        if (isEnergyUsing)
        {
            UI_manager = GameObject.Find("UI_Canvas").GetComponent <UI_Manager>();
            UI_manager.SetWaterUI(waterEnergy);
            SetPurityDegree();
        }
    }
Esempio n. 16
0
    void Start()
    {
        SetPlayerStartPosition();
        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <Spawn_Manager>();
        _uiManager    = GameObject.Find("Canvas").GetComponent <UI_Manager>();
        if (_uiManager == null)
        {
            Debug.LogError("UI Manager is Null!");
        }
        SpawnManagerNullCheck();

        _audioSource = GetComponent <AudioSource>();
        if (_audioSource == null)
        {
            Debug.LogError("Audio Source is Null!");
        }
        else
        {
            _audioSource.clip = _laserSoundClip;
        }
    }
Esempio n. 17
0
    public override void Enter()
    {
        Time.timeScale = 0;

        uiMng         = context.GetGameManager().GetUIManager();
        currentUICtrl = uiMng.GetCurrentUIController();

        lvlMng        = context.GetGameManager().GetLevelManager();
        lvlPauseCtrl  = lvlMng.GetLevelPauseController();
        groupCtrl     = lvlMng.GetGroupController();
        uiPausePanel  = currentUICtrl.GetMenu <UIMenu_Pause>();
        gameplayPanel = currentUICtrl.GetMenu <UIMenu_Gameplay>();

        lvlPauseCtrl.OnGameUnpause         += HandleOnGameUnpause;
        uiPausePanel.ResumeButtonPressed   += HandleOnGameUnpause;
        uiPausePanel.MainMenuButtonPressed += HandleOnMainMenuButtonPressed;

        oldGroupStatus = groupCtrl.IsEnabled();
        groupCtrl.Enable(false);
        currentUICtrl.SetCurrentMenu <UIMenu_Pause>();
    }
Esempio n. 18
0
    void Start()
    {
        Debug.Log("_velocidad es " + speed);
        initialSpeed       = speed;                  //velocidad inicial = velocidad
        canon              = GetComponent <Canon>(); //obtener cañón, arma con la que dispara
        transform.position = Vector3.zero;           //esto hace que su posición inicil sea simepre cero

        vidas = 3;                                   //asignación de numeros de vida
        engines[0].SetActive(false);
        engines[1].SetActive(false);
        shieldGameObject = transform.Find("Shields").gameObject;
        shieldGameObject.SetActive(false);
        uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>();
        if (uiManager != null)
        {
            uiManager.UpdateLives(vidas);
        }

        gameManager = GameObject.FindObjectOfType <GameManager>();
        //gameManager = GameObject.Find("Canvas").GetComponent<GameManager>();
    }
Esempio n. 19
0
    void Start()
    {
        transform.position = new Vector3(0, 0, 0);

        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();

        UI = GameObject.Find("Canvas UI_Manager").GetComponent <UI_Manager>();



        if (_spawnManager == null)
        {
            Debug.LogError("SpawnManager is not in scene");
        }



        if (UI == null)
        {
            Debug.LogError("UI_manager is not in scene");
        }
    }
Esempio n. 20
0
    void Start()
    {
        if (b_GrowAndCountedBlossom)
        {
            //---計算豐饒---
            thisGrassRange   = this.GetComponent <BoxCollider2D>().size.x;
            totalGrassRange += thisGrassRange;

            if (GameObject.Find("UI_Canvas") == null)
            {
                UI_manager = null;
            }
            else
            {
                UI_manager = GameObject.Find("UI_Canvas").GetComponent <UI_Manager>();
            }

            //---草長出---
            animator      = GetComponent <Animator>();
            b_animateGrow = (animator != null);

            if (!b_animateGrow)
            {
                oriYPos = transform.position.y;
                this.transform.position -= new Vector3(0f, YShift, 0f);
                this.GetComponent <BoxCollider2D>().offset = new Vector2(0f, YShift);
            }
        }
        else
        {
            animator = GetComponent <Animator>();
            if (animator != null)
            {
                animator.enabled = false;
            }
        }

        GetComponent <Collider2D>().enabled = false;
    }
Esempio n. 21
0
    void Start()
    {
        gm        = GameObject.FindGameObjectWithTag("GameController").GetComponent <DataPersistance>();
        mat.color = new Color(1.0f, 1.0f, 1.0f);

        if (gm.firstTimeLoading == false)
        {
            health = gm.getPlayerHealth();
        }
        else
        {
            health = 3;
            gm.setPlayerScore(0);
            gm.firstTimeLoading = false;
        }

        gm.setPlayerHealth(health);

        gameOver  = gameObject.GetComponent <SceneController>();
        uiManager = UI.GetComponent <UI_Manager>();
        PlayerPrefs.SetInt("HighScore", 0);
    }
Esempio n. 22
0
    // Use this for initialization
    void Start()
    {
        transform.position = new Vector3(0, 0, 0);
        _uIManager         = GameObject.Find("Canvas").GetComponent <UI_Manager>();

        if (_uIManager != null)
        {
            _uIManager.UpdateLives(_lives);
        }

        _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <Spawn_Manager>();

        if (_spawnManager != null)
        {
            _spawnManager.StartSpawnRoutines();
        }

        _audioSource = GetComponent <AudioSource>();
        _hitCount    = 0;
    }
Esempio n. 23
0
 void Start()
 {
     //
     Instance = this;
     for (int i = 0; i < pages.Count; i++)
     {
         if (i == (int)initState)
         {
             pages[i].SetActive(true);
         }
         else
         {
             pages[i].SetActive(false);
         }
     }
     currentState = initState;
     //
     foreach (var item in pages)
     {
         SetResolution.SetAResolution(item.transform);
     }
 }
Esempio n. 24
0
        public GameManager(int screen_width, int screen_height)
        {
            m_screen_width  = screen_width;
            m_screen_height = screen_height;

            m_gui_object_textures = new Hashtable();
            m_road_textures       = new Texture2D[5];
            m_scenery_textures    = new Texture2D[5][];
            m_camera = new Camera(m_screen_width, m_screen_height);

            // setup UI
            ui_manager = new UI_Manager(m_screen_width, m_screen_height);
            db_manager = new DB_Manager();

            db_manager.DeleteSaveDB("hallelujah");
            db_manager.CreateSaveDB("hallelujah");
            //db_manager.LoadDB("hallelujah");

            db_manager.LoadDataIntoDB();

            m_last_keyboardstate = Keyboard.GetState();
        }
Esempio n. 25
0
        /// <summary>
        /// 关闭当前UI窗体
        /// </summary>
        public void CloseUIForm()
        {
            string strUIFromName = string.Empty;            //处理后的UIFrom 名称
            int    intPosition   = -1;

            strUIFromName = GetType().ToString();             //命名空间+类名
            intPosition   = strUIFromName.IndexOf('.');
            if (intPosition != -1)
            {
                //剪切字符串中“.”之间的部分,也就是命名空间后面的部分
                strUIFromName = strUIFromName.Substring(intPosition + 1);
            }
            //最后得到的就是当前UI窗体名称
            if (UI_Manager != null)
            {
                UI_Manager.CloseUIForms(strUIFromName);
            }
            else
            {
                GameMainProgram.Instance.uiManager.CloseUIForms(strUIFromName);
            }
        }
Esempio n. 26
0
    //로그아웃 처리
    void Process_LogOut()
    {
        //로그아웃하므로 변수 값 변경
        UserDataManager.instance.user.LogInState = Login_State.LogOut;

        //기존 연동된 계정 로그아웃
        PlatformManager.Getsingleton.Platform_LogOut();

        //채팅서버 연결 끊기
        Network_MainMenuSoketManager.Getsingleton.Disconnect(DISCONNECT_STATE.NORMALITY, "로그아웃 의한 서버끊기");

        //webReseponse 변수값 초기화
        webResponse.Init();


        //모든유저정보 초기화
        UserDataManager.instance.user.Init();


        UI_Manager ui_manager = UI_Manager.Getsingleton;

        ui_manager.CreatUI(UI.TITLE, ui_manager.CanvasTr);
    }
    public override void Enter()
    {
        startState = false;
        adsMng     = UnityAdsManager.instance;
        gm         = context.GetGameManager();
        spawnCtrl  = gm.GetSpawnController();
        uiMng      = gm.GetUIManager();
        shapeCtrl  = gm.GetShapeController();
        bgMng      = gm.GetBackgroundManager();
        printCtrl  = gm.GetPrintController();
        scoreCtrl  = gm.GetScoreController();
        musicCtrl  = gm.GetMusicController();

        PrintController.OnShapeGuessed += HandleOnShapeGuessed;
        PrintController.OnShapeWrong   += HandleOnShapeWrong;
        ShapeController.OnShapeChanged += HandleOnShapeChange;
        ShapeController.OnNewShapeAdd  += HandleOnNewShapeAdd;
        gm.OnGameEnd += HandleOnGameEnd;

        gameplayPanel = uiMng.GetMenu <UIMenu_Gameplay>();
        printCtrl.EnableGraphic(false);
        uiMng.SetCurrentMenu <UIMenu_Gameplay>(0.5f, 0.5f, OnGameplayFadeIntCallback, OnGameplayFadeOutCallback);
    }
Esempio n. 28
0
        // When the app starts, check to make sure that we have
        // the required dependencies to use Firebase, and if not,
        // add them if possible.
        protected virtual void Start()
        {
            Debug.Log("Initializing Firebase Database");
            //leaderBoard.Add("Firebase Top " + MaxScores.ToString() + " Scores");
            //FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tfg-2019-20.firebaseio.com/");
            //DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;

            _auth      = AppManager.Instance.UserAuthentification;
            _uiManager = UI_Manager.Instance;

            FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
                dependencyStatus = task.Result;
                if (dependencyStatus == DependencyStatus.Available)
                {
                    InitializeFirebase();
                }
                else
                {
                    Debug.LogError(
                        "Could not resolve all Firebase dependencies: " + dependencyStatus);
                }
            });
        }
Esempio n. 29
0
    //public int player1_AttackPower;
    //public float player2_AttackPower;

    // Use this for initialization
    void Start()
    {
        Set_Player1_AttackPower(1);

        uiManager_Obj = GameObject.Find("UI Manager");
        uiManager     = uiManager_Obj.GetComponent <UI_Manager>();

        // default to 1
        Set_Player1_AttackPower(1);
        Set_Player1_AttackPower(1);

        //player1_AttackPower = 0;
        //player2_AttackPower = 0;

        ResetTimer();
        attacking_turn = 0;

        Player1 = GameObject.Find("Player 1");
        Player2 = GameObject.Find("Player 2");

        // set number of hits
        ResetNumberOfHits();
    }
Esempio n. 30
0
    void Start()
    {
        _leftEngineDamage.SetActive(false);
        _rightEngineDamage.SetActive(false);
        _laser        = _laserPrefab.GetComponent <Laser>();
        _uiManager    = GameObject.Find("Canvas").GetComponent <UI_Manager>();
        _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();
        _gameManager  = GameObject.Find("Game_Manager").GetComponent <GameManager>();
        _joystick     = FindObjectOfType <Joystick>();
        _joybutton    = FindObjectOfType <Joybutton>();

        _audioSource = GetComponent <AudioSource>();
        _sr          = GetComponent <SpriteRenderer>();
        _matWhite    = Resources.Load("White_mat", typeof(Material)) as Material;
        _matDefault  = _sr.material;


        if (_spawnManager == null)
        {
            Debug.LogError("The Spawn Manager is Null");
        }

        if (_uiManager == null)
        {
            Debug.LogError("The UI Manager is Null");
        }

        if (_audioSource == null)
        {
            Debug.LogError("The audio source on the player is Null");
        }

        else
        {
            _audioSource.clip = _laserSoundClip;
        }
    }
Esempio n. 31
0
    void Start()
    {
        if (!mouse)
        {
            inputManager   = new InputManagerController();
            hitBy2ndPlayer = 1;
            hitStatus      = 2;
            playercolor2nd = Color.red;
        }
        else
        {
            inputManager   = new InputManagerMouse();
            hitBy2ndPlayer = 2;
            hitStatus      = 1;
            playercolor2nd = Color.green;
        }
        effectToSpawn          = vfx[0];
        effectToSpawnStart     = vfx[1];
        effectToSpawnImplosion = vfx[2];
        Cursor.lockState       = CursorLockMode.Locked;
        charContr     = GetComponent <CharacterController>();
        currentMana   = maxMana;
        currentHealth = maxHealth;
        grav          = GetComponent <Gravity> ();
        grav.enabled  = false;
        mouseLook     = Camera.main.gameObject.GetComponent <camMouseLook> ();

        layerMask       = 1 << 8 | 1 << 2;
        layerMask       = ~layerMask;
        anim            = GetComponentInChildren <Animator>();
        ui_man          = FindObjectOfType <UI_Manager>();
        timeSinceDashed = dashCooldown;
        ppp             = GetComponentInChildren <PostProcessingBehaviour>().profile;
        //animDummy.SetFloat("AnimSpeed", 1f);
        //anim.SetFloat("AnimSpeed", 1f);
        //SendHPToUIMan();
    }
Esempio n. 32
0
    // Start is called before the first frame update
    void Start()
    {
        startTime = Time.time;
        _ball     = GameObject.Find("ball1").GetComponent <Ball>();

        // Create temporary objects to get starting positions of paddles
        GameObject tempObject = new GameObject();

        _computer = tempObject.AddComponent <Computer>();
        _player   = tempObject.AddComponent <Player>();

        _computer = Instantiate(computerPrefab, _computer.startingPosition, Quaternion.identity).GetComponent <Computer>();
        computer  = _computer;
        _player   = Instantiate(playerPrefab, _player.startingPosition, Quaternion.identity).GetComponent <Player>();
        player    = _player;

        Destroy(tempObject);

        uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>();

        SpawnBall();

        uiManager.StartCoroutine(uiManager.escTextFlicker());
    }
Esempio n. 33
0
 void OnEnable()
 {
     Instance = this;
 }
Esempio n. 34
0
 void Awake()
 {
     Instance = this;
 }
Esempio n. 35
0
        public IEnumerator startStoryline()
        {
            yield return new WaitForSeconds(0.005f);

            ui_Manager = FindObjectOfType<UI_Manager>();
            floorManager = GameObject.Find("FloorManager");

            //Storyline demo = new Storyline(0, 1, "Demo Storyline", "Let's see how good is your mobile app!");

            mc = FindObjectOfType<MapController>();

            map = mc.getMap();

            iBeaconHandler bh = iBeaconHandler.GetComponent<iBeaconHandler>();
            List<Beacon> beacons = bh.getBeacons();
            int slID = PlayerPrefs.GetInt("storylineID");

            DisplayFloor(2); //this should be the first floor

            map.initializeLists(arrayOfNodes);

            print("Storyline id is: " + slID);
            map.GetStoryline(slID).setBeaconList(beacons);

            map.startStoryline(map.getStorypointNodes(), slID);

            foreach (var sp in map.GetStoryline(slID).getStorypointList())
            {
                print("Storypoint " + sp.id + " and is in order " + map.GetStoryline(slID).isInOrder(sp));
            }

            /*List<Node> orderedPath = map.orderedPath(instantiatedNodes, slID);

            //map.setStorypointList(orderedPath);

            map.startStoryline(orderedPath, slID);

            map.GetStoryline(slID).getStorypointList()[0].setBeacon(new iBeaconServer("B9407F30-F5F8-466E-AFF9-25556B57FE6D", 38714, 26839));

            POS sp = map.GetStoryline(slID).getStorypointList()[0];

            sp.displayStorylinePopUpWindow();

            /*print(map.GetStoryline(slID).getStorypointList().Count);
            foreach (var sp in map.GetStoryline(slID).getStorypointList())
            {
                print(sp.storylineID);
            }

            /*
            foreach (var d in sp.GetPoiDescriptionList())
            {
                print("Title: " + d.title + ", language: " + d.language + ", description: " + d.summary);
            }*/

            //map.GetStoryline(slID).getStorypointList()[0].setBeacon(new iBeaconServer("B9407F30-F5F8-466E-AFF9-25556B57FE6D", 38714, 26839));

            //shortestPathCreator.transform.position = new Vector3(instantiatedNodes[0].transform.position.x, instantiatedNodes[0].transform.position.y, -7);
        }
Esempio n. 36
0
    void OnEnable()
    {
        // First thing is to se the singleton reference, many things will use this, and this object spawns pretty much everything
        instance = this;

        if(textureManager == null) {
            Debug.LogError("WorldManager Does not have a texture manager assigned! Please add one as a child and assign it to the world manager in the inspector!");
        }

        // Start by loading all data
        craftingItemState = ItemUtility.LoadCraftingItems(craftingItemFile);
        if(craftingItemState == null) {
            Debug.Log("ERROR! No crafting items found at " + craftingItemFile);
        }

        wearableItemState = ItemUtility.LoadWearableItems(wearableItemFile);
        if(wearableItemState == null) {
            Debug.Log("ERROR! No wearable items found at " + wearableItemFile);
        }

        textUtility = ProceduralTextUtility.LoadTextTypes(textSourceFile);
        if(textUtility == null) {
            Debug.Log("ERROR! No procedural text source file found at " + textSourceFile);
        }

        dieties = new Diety[NUM_DIETIES];
        for(int i = 0; i < NUM_DIETIES; i++) {
            string prefix = "";
            string title = "";
            string suffix = "";

            textUtility.GenerateCompleteName(ref prefix, ref title, ref suffix);

            Diety d = new Diety(prefix, title, suffix);
            dieties[i] = d;
        }

        // Next grabs the world generator, which should be attached to the world manager object
        worldGenerator = GetComponent<WorldGenerator>();
        if(worldGenerator == null) {
            Debug.LogWarning("WARNING! No world generator found on "+name+". No terrain will be created!");
        }

        // Grab the gramlin manager: this isnt suuuuper critical, but the game really doesnt work without it
        lootGremlinSpawnManager = GetComponent<LootGremlinSpawner>();
        if(worldGenerator == null) {
            Debug.LogWarning("WARNING! No LootGremlinSpawner found on " + name + ". No Loot gremlins will be spawned!");
        }

        uiManager = new UI_Manager();

        objectPool = new ObjectPool();

        sunLight = (Light)Instantiate(sunPrototype, new Vector3(0.0f, 0.0f, -10.0f), Quaternion.identity);
        maxSunIntensity = sunLight.intensity;

        // attempt to load game state, if it exists, otherwise create a new one
        gameState = GameStateUtility.LoadGameState(saveLocation);
        if(gameState == null) {
            gameState = new GameStateUtility();
            GameStateUtility.SaveGameState(saveLocation, gameState);
        }

        if(playerPrototype == null) {
            Debug.LogError("Player prototype is not set, cannot initialize game!");
            return;
        }
        playerStartLocation = worldGenerator.GeneratorOrigin();
        playerCharacter = (Player)Instantiate(playerPrototype, playerStartLocation, Quaternion.identity);

        // Assign the state that was loaded
        if(gameState.playerState != null) {
            playerCharacter.SetState(gameState.playerState);
        }
        else {
            Debug.Log("ERROR! Player state was not loaded / created in the game state!");
        }

        if(worldGenerator != null) {
            worldGenerator.StartGeneratingWorld(playerCharacter);
        }

        // Instaniate all of the background layers from prototypes: they are self managing
        foreach(ParallaxBackground bg in backGroundSet) {
            Instantiate(bg.gameObject);
        }

        // Fill out the ability object map with the editor assigned objects, mapped to names
        abilityObjectMap = new Dictionary<string, GameObject>();
        foreach(GameObject obj in spawnableObjects) {
            if(obj != null) {
                abilityObjectMap.Add(obj.name, obj);
            }
        }

        pawnsOnScreen = new List<Pawn>();
    }
Esempio n. 37
0
 void Awake()
 {
     instance = this;
 }
Esempio n. 38
0
    // Use this for initialization
    void Start()
    {
        // Save reference to Tardi's Rigid Body
        rb = this.GetComponent<Rigidbody> ();

        // Initialize the uiManager;
        uiManager = GameObject.FindWithTag("MainCamera").GetComponent<UI_Manager>();

        // Reset Score
        uiManager.ResetSurvivalScore ();
    }
Esempio n. 39
0
    public IEnumerator startFreeRoaming()
    {
        yield return new WaitForSeconds(0.005f);

        ui_Manager = FindObjectOfType<UI_Manager>();

        floorManager = GameObject.Find("FloorManager");

        freeRoamingTour = FindObjectOfType<FreeRoaming>();
        mc = FindObjectOfType<MapController>();

        map = mc.getMap();

        iBeaconHandler bh = iBeaconHandler.GetComponent<iBeaconHandler>();
        List<Beacon> beacons = bh.getBeacons();

        DisplayFloor(2);

        map.initializeLists(arrayOfNodes);

        freeRoamingTour.setBeaconList(beacons);

        freeRoamingTour.initializeLists(map.GetPoiNodes());

        shortestPathCreator.transform.position = new Vector3(arrayOfNodes[0].transform.position.x, arrayOfNodes[0].transform.position.y, -7);
        /*public IEnumerator startStoryline()
        {
            yield return new WaitForSeconds(0.005f);

            ui_Manager = FindObjectOfType<UI_Manager>();
            floorManager = GameObject.Find("FloorManager");

            //Storyline demo = new Storyline(0, 1, "Demo Storyline", "Let's see how good is your mobile app!");

            mc = FindObjectOfType<MapController>();

            map = mc.getMap();

            iBeaconHandler bh = iBeaconHandler.GetComponent<iBeaconHandler>();
            List<Beacon> beacons = bh.getBeacons();
            int slID = PlayerPrefs.GetInt("storylineID");

            print("Storyline id is: " + slID);
            map.GetStoryline(slID).setBeaconList(beacons);

            List<Node> orderedPath = map.orderedPath(slID);

            //map.setStorypointList(orderedPath);
            map.startStoryline(orderedPath, slID);
            DisplayFloor(2, slID); //this should be the first floor

            map.GetStoryline(slID).getStorypointList()[0].setBeacon(new iBeaconServer("B9407F30-F5F8-466E-AFF9-25556B57FE6D", 38714, 26839));

            shortestPathCreator.transform.position = new Vector3(gameObjectNodesList[0].transform.position.x, gameObjectNodesList[0].transform.position.y, -7);
            */
    }
Esempio n. 40
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     SetAllScreensToInactive ();
 }
Esempio n. 41
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     spaceStationObject = GameObject.Find ("SpaceStore");
     SetAllScreensToInactive();
 }