Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     mech       = GetComponent <MechActor>();
     mainCamera = GetComponentInChildren <Camera>();
     cameraBoom = mainCamera.transform.parent;
     HUD        = GameObject.FindGameObjectWithTag("PlayerHUD").GetComponent <HUDController>();
 }
Example #2
0
    public void Awake()
    {
        rb2d             = GetComponent <Rigidbody2D>();
        featherParticles = GameObject.FindGameObjectWithTag("FeatherParticles").GetComponent <ParticleSystem>();
        bubbleParticles  = GameObject.FindGameObjectWithTag("BubbleParticles").GetComponent <ParticleSystem>();
        hudC             = GameObject.FindGameObjectWithTag("Canvas").GetComponent <HUDController>();
        audioJump        = AddAudio(jumpSFX, false, false, 1.0f);
        audioHurt        = AddAudio(hurtSFX, false, false, 1.0f);
        audioDie         = AddAudio(dieSFX, false, false, 1.0f);

        /*
         * if ( water level ) {
         *     bubbleParticles.Play();
         * }
         */
        stats = GameObject.FindGameObjectWithTag("Stats").GetComponent <Stats>();
        stats.SetYouStats(this);
        Stat.SetHeartsEggs(this);
        if (hearts < 0 && eggs < 0)
        {
            hearts = startHearts + ApplyStamina();
            eggs   = StartEggs + ApplyFertility();
            stats.LoadHeartsEggs(this);
            hudC.SetPC(this);
            hudC.ResetHealth();
            hudC.ResetLives();
        }
    }
Example #3
0
    IEnumerator Defending(Player player, float time, float endTime, int chainNum)
    {
        HUDController HUDcontroller = player.HpHUD.GetComponent <HUDController>();

        if (effectPrefab == null)
        {
            effectPrefab = Instantiate(EffectPrefab, player.transform.position, Quaternion.identity);

            effectPrefab.transform.parent = GameManager.instance.EffectHolder.transform;
        }
        HUDcontroller.Status[6].SetActive(true);

        player.DefensiveRatio = player.InitDefensiveRatio - (0.2f * chainNum);

        yield return(new WaitForSeconds(time));

        if (endTime < EndTime)
        {
            yield break;
        }

        HUDcontroller.Status[6].SetActive(false);

        Destroy(effectPrefab);

        player.DefensiveRatio = player.InitDefensiveRatio;
    }
Example #4
0
    private void Start()
    {
        hudController         = GameObject.FindGameObjectWithTag(Tags.HUD).GetComponent <HUDController>();
        explodeTrashCoroutine = WaitAndExplodeTrash(WaitTime);

        StartCoroutine(explodeTrashCoroutine);
    }
 // Start is called before the first frame update
 void Start()
 {
     _hudController = FindObjectOfType <HUDController>();
     _player        = FindObjectOfType <PlayerController>();
     screenBounds   = GetScreenBounds();
     StartCoroutine(SpawnEnemies());
 }
Example #6
0
    void Awake()
    {
        shipHealthManager = GameObject.FindGameObjectWithTag("Ship").GetComponent <ShipHealthManager>();
        scoreController   = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreController>();
        hudController     = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUDController>();
        soundController   = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundController>();
        shipCollider      = GetComponent <Collider2D>();
        shipAmmo          = 100;

        nukeDelayTime    = 8f;
        weaponsDelayTime = 10f;

        fireRate             = baseShipFireRate;
        fireAllowed          = true;
        hasBerserkerMode     = false;
        hasLaserMode         = false;
        shipHasSpecialBullet = false;
        canDeployNuke        = true;

        typeOfFiringSystem = "defaultBullet";
        typeOfShipName     = this.gameObject.name;

        hudController.UpdateNukesHUD(GetAmountOfNukes());
        hudController.SetNukeCooldownTimersActive(false);
    }
Example #7
0
    private bool newTaskbarIsEnabled = false; // NOTE(Santi): This is temporal, until we remove the old taskbar

    private void Awake()
    {
        i = this;

        toggleUIVisibilityTrigger              = Resources.Load <InputAction_Trigger>(TOGGLE_UI_VISIBILITY_ASSET_NAME);
        toggleUIVisibilityTrigger.OnTriggered += ToggleUIVisibility_OnTriggered;
    }
Example #8
0
    /// <summary>
    /// Populates the hand by getting the selected player's hand
    /// </summary>
    public void PopulateHand()
    {
        if (hudController == null)
        {
            hudController = this.GetComponentInParent <HUDController> ();
        }

        firstCard = null;

        cardsList = hudController.selectedPlayer.Hand;
        //Debug.Log (hudController.selectedPlayer);
        cards.Clear();
        for (int i = 0; i < cardsList.Count; i++)
        {
            cards.Insert(i, cardsList[i].gameObject);
        }

        //If the hudController isn't displaying another player
        if (hudController.otherPlayerShown == false)
        {
            //set first card
            if (cards != null && cards.Count > 0)
            {
                firstCard = cards [0].GetComponent <Card> ();
            }

            ResizeCards();
        }
        //Sets the card back number for the other player
        else
        {
            SetHandBack(hudController.selectedPlayer.Hand.Count);
        }
    }
Example #9
0
 private void Start()
 {
     if (this.Spawn == null)
     {
         this.Spawn = FindObjectOfType <Spawn>();
     }
     if (this.HudController == null)
     {
         this.HudController = FindObjectOfType <HUDController>();
     }
     if (this.CameraController == null)
     {
         this.CameraController = FindObjectOfType <CameraController>();
     }
     if (this.WorldScript == null)
     {
         this.WorldScript = FindObjectOfType <WorldScript>();
     }
     if (this.AudioController == null)
     {
         this.AudioController = FindObjectOfType <AudioController>();
     }
     this.disasterCount = new int[GameVariables.Desatres.GetNames(typeof(GameVariables.Desatres)).Length];
     this.HudController.SetGameController(this);
     this.CameraController.SetGameController(this);
 }
    // private Rigidbody rb;

    // Start is called before the first frame update
    void Start()
    {
        spellArr        = new GameObject[3];
        _hudCntrl       = HUDController.Instance;
        agent           = GetComponent <UnityEngine.AI.NavMeshAgent>();
        _gameController = GameController.Instance;
    }
Example #11
0
 // Use this for initialization
 void Start()
 {
     objectInteration = GetComponent <InteractObjectBase>();
     hudcontroller    = GameObject.Find("GameController").GetComponent <HUDController>();
     player           = GameObject.Find("Player");
     buttonpress      = GameObject.Find("AudioButtonPress").GetComponent <AudioSource>();
 }
Example #12
0
    IEnumerator AttackUp(Player player, float time, float endTime, int ChainNum)
    {
        Devil.SetActive(true);

        HUDController HUDcontroller = player.HpHUD.GetComponent <HUDController>();

        player.Hp = (int)(player.Hp * (0.95f - (0.05f * ChainNum)));

        player.HpBarUpdate();

        player.Damage = player.InitDamage * 3 * ChainNum;

        HUDcontroller.Status[2].SetActive(true);

        yield return(new WaitForSeconds(time));

        if (endTime < EndTime)
        {
            yield break;
        }

        player.Damage = player.InitDamage;

        HUDcontroller.Status[2].SetActive(false);

        Devil.SetActive(false);
    }
Example #13
0
    private void Start()
    {
        // load local resources
        // (moving all logic from start function to this first time function)
        gameDataSaver = GetComponent <GameDataSaver>();
        logoutButton.onClick.AddListener(onLogout);
        exitButton.onClick.AddListener(onExit);
        logoutCanvas     = FindObjectOfType <LogoutCanvas>();
        questWindowUI    = FindObjectOfType <QuestWindowUI>();
        reviveController = FindObjectOfType <ReviveController>();
        hud              = FindObjectOfType <HUDController>();
        dialogueUI       = FindObjectOfType <DialogueUI>();
        actionBar        = GetComponentInChildren <ActionBarController>();
        inventoryManager = gameObject.GetComponentInChildren <InventoryManager>(true);
        inventory        = inventoryManager.inventory;
        equipment        = gameObject.GetComponentInChildren <EquipmentPanel>(true).equipment;

        // set up component
        logoutCanvas.gameObject.SetActive(false);
        hud.gameObject.SetActive(false);
        QuestManager.instance.questWindowUI = questWindowUI;
        DialogueManager.instance.dialogueUI = dialogueUI;
        StartCoroutine(LoadGameScene());
        exitButton.enabled = false;
        logoutButton.gameObject.SetActive(false);
        exitButton.gameObject.SetActive(false);

        // If game data exists in the database
        // Override the first stats load using the user data
        if (User.GetActiveCharacter().GameState.isDirty)
        {
            GameCharacter.Stats = GameCharacter.GetStatsFromData(UserService.Instance.User.GetActiveCharacter().GameState.Stats);
            GameCharacter.Stats.Setup();
        }
    }
Example #14
0
        public IEnumerator CreateHudIfConfigurationIsActive()
        {
            // There must be a hud controller
            HUDController hudController = HUDController.i;

            Assert.IsNotNull(hudController, "There must be a HUDController in the scene");

            HUDConfiguration config = new HUDConfiguration()
            {
                active = true, visible = true
            };

            for (int i = 1; i < (int)HUDController.HUDElementID.COUNT; i++)
            {
                hudController.ConfigureHUDElement((HUDController.HUDElementID)i, config, null);
            }

            yield return(null);

            // HUD controllers are created
            for (int i = 1; i < (int)HUDController.HUDElementID.COUNT; i++)
            {
                Assert.IsNotNull(hudController.GetHUDElement((HUDController.HUDElementID)i), $"Failed to create {(HUDController.HUDElementID) i}");
            }
        }
 private void Start()
 {
     hUDController = FindObjectOfType <HUDController>();
     playerSpeed   = 10;
     screenBounds  = GetScreenBounds();
     StartCoroutine(SpawnEnemies());
 }
	/// <summary>
	/// Sets the sides up, the end condition up, and the turn counter.
    /// 
    /// Alex Reiss
	/// </summary>
	void Start () 
    {
        for (int index = 0; index < playerTeam.Count; index++)
            playerTeam[index].theSide = GameControllerBehaviour.UnitSide.player;

        for (int index = 0; index < enemyTeam.Count; index++)
            enemyTeam[index].theSide = GameControllerBehaviour.UnitSide.enemy;

        for (int index = 0; index < nuetrals.Count; index++)
            nuetrals[index].theSide = GameControllerBehaviour.UnitSide.nuetral;

        playerTeamTotal = playerTeam.Count;
        enemyTeamTotal = enemyTeam.Count;
        nuetralTotal = nuetrals.Count;
        leftToMoveThis = playerTeamTotal;

        gUIStyle = new GUIStyle();
        gUIStyle.fontSize = 10;
        gUIStyle.normal.textColor = Color.white;
		
		controller = Camera.main.GetComponent<HUDController>();
		controller.whoseTurn.text = "Players Turn";
		controller.turnCount.text = "Turn " + numberOfTurns.ToString ();
		

		TalkingEventManagerBehaviour talkingManager = Camera.main.GetComponent<TalkingEventManagerBehaviour> ();
		if(talkingManager != null)
			talkingManager.StartTalkingEventChain(SceneConversationBehavior.instance.introConversation);
	}
Example #17
0
    private void Awake()
    {
        manager   = GameObject.Find("GameManager").GetComponent <Manager>();
        playerPos = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        HUD       = GameObject.Find("GameManager").GetComponent <HUDController>();
        HUD.boss  = this;
        right     = transform.right;
        left      = -transform.right;
        if (Random.value <= .5f)
        {
            rotateSide = right;
        }
        else
        {
            rotateSide = left;
        }
        head.gameObject.GetComponent <BoxCollider2D>().enabled = false;
        fireCounter       = fireRate;
        clawAttackCounter = clawAttackRate;

        if (type == 2)
        {
            PlayerPrefs.SetFloat("MusicVolume", 0);
            PlayerPrefs.SetFloat("SFXVolume", 0);
        }
    }
Example #18
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }

        team1.SetActive(false);
        foreach (PlayerHUD p in team1Players)
        {
            p.gameObject.SetActive(false);
        }

        team2.SetActive(false);
        team3.SetActive(false);
        team4.SetActive(false);
        winner.gameObject.SetActive(false);
        error.gameObject.SetActive(false);
        HUD.SetActive(false);
        message.SetText("");
    }
    void Start()
    {
        if (_instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;
            DontDestroyOnLoad(gameObject);
        }

        _paused     = false;
        _dead       = false;
        _name       = "Test Name";
        _score      = 0;
        _lives      = 3;
        _multiplier = 1;
        _target     = 50;

        if (PlayerPrefs.HasKey("HighScore"))
        {
            _highscore = PlayerPrefs.GetInt("HighScore");
        }

        _controller = GameObject.Find("HUD").GetComponent <HUDController>();
        _controller.UpdateScore(_score);
        _controller.UpdateLives(_lives);
        _controller.UpdateMultiplier(_multiplier);
        _controller.UpdateTarget(_target);
        _controller.UpdateHighScore(_highscore);

        data = new GameData();
    }
Example #20
0
    /// <summary>
    /// Checks if the cards displayed belong to the HUDController's
    /// selected player
    /// </summary>
    /// <returns><c>true</c>, if cards belong to selectedplayer.</returns>
    /// <returns><c>false</c> otherwise.</returns>
    public bool CheckCardsDisplayed()
    {
        //preventing null reference
        if (hudController == null)
        {
            hudController = this.GetComponentInParent <HUDController> ();
        }

        if (hudController.selectedPlayer != null)
        {
            if (cards != null && cards.Count > 0)
            {
                if (firstCard == null)
                {
                    firstCard = cards [0].GetComponent <Card> ();
                }

                if (firstCard.cardOwner != hudController.selectedPlayer)
                {
                    return(false);
                }
            }
        }
        return(true);
    }
Example #21
0
        public IEnumerator CreateHudIfConfigurationIsActive()
        {
            // There must be a hud controller
            Assert.IsNotNull(hudController, "There must be a HUDController in the scene");

            HUDConfiguration config = new HUDConfiguration()
            {
                active = true, visible = true
            };

            for (int i = 1; i < (int)HUDElementID.COUNT; i++)
            {
                hudController.ConfigureHUDElement((HUDElementID)i, config, null);
            }

            yield return(null);

            // HUD controllers are created
            for (int i = 1; i < (int)HUDElementID.COUNT; i++)
            {
                HUDElementID elementID = (HUDElementID)i;
                if (HUDController.IsHUDElementDeprecated(elementID))
                {
                    continue;
                }

                Assert.IsNotNull(hudController.GetHUDElement(elementID), $"Failed to create {elementID}");
            }
        }
Example #22
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     healthSlider.maxValue = player.maxHealth;
     healthSlider.value    = player.maxHealth;
     currentBulletCount    = 0;
 }
Example #23
0
    //public GameObject[] teams;
    //public GameObject teamObjectPrefab;

    void Start()
    {
        hUDController = FindObjectOfType <HUDController>();
        screenBounds  = GetScreenBounds();

        MatchCommunicationManager.Instance.OnAsteroidSpawned += OnSpawnAsteroid;
        MatchCommunicationManager.Instance.OnPlayerSpawned   += OnSpawnPlayers;
        MatchCommunicationManager.Instance.OnBallSpawned     += OnSpawnBalls;
        MatchCommunicationManager.Instance.OnGoalSpawned     += OnSpawnGoals;

        if (MatchMaker.Instance.IsHost)
        {
            MatchCommunicationManager.Instance.OnPlayerInputRotationUpdated += PlayerInputRotationUpdated;
            MatchCommunicationManager.Instance.OnPlayerInputThrustUpdated   += PlayerInputThrustUpdated;
        }
        else
        {
            MatchCommunicationManager.Instance.OnPlayerPositionUpdated   += PlayerPositionUpdated;
            MatchCommunicationManager.Instance.OnAsteroidPositionUpdated += AsteroidPositionUpdated;
            MatchCommunicationManager.Instance.OnBallPositionUpdated     += BallPositionUpdated;
        }

        if (MatchMaker.Instance.IsHost)
        {
            MatchCommunicationManager.Instance.SendMatchStateMessageSelf(MatchMessageType.StadiumEntered,
                                                                         new MatchMessageStadiumEntered(ServerSessionManager.Instance.Session.UserId));
        }
        else
        {
            MatchCommunicationManager.Instance.SendMatchStateMessage(MatchMessageType.StadiumEntered,
                                                                     new MatchMessageStadiumEntered(ServerSessionManager.Instance.Session.UserId));
        }
    }
Example #24
0
 public void InitializeSingleton()
 {
     if (_instance == null)
     {
         _instance = this;
     }
 }
Example #25
0
    private void Start()
    {
        HUDController contr = GetComponentInParent <HUDController>();

        startMat  = contr.normal;
        selectMat = contr.select;
    }
Example #26
0
    // Use this for initialization
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;

        // Initialize values
        _resources = _initialResourceCount;
        _weapons   = new List <Weapon>();
        _health    = GetComponent <Health>();
        _health.OnHealthChanged += OnHealthChanged;

        if (isLocalPlayer)
        {
            // Game camera
            _gameCamera = FindObjectOfType <GameCamera>();
            _obstaclePlacementContainer      = _gameCamera.ObstaclePlacementContainer;
            _gameCamera.Target               = _focalPoint;
            _gameCamera.RotationAnchorObject = _rotationPoint;

            // HUD elements
            _hud = FindObjectOfType <HUDController>();
            _hud.ShowScreen("regular");
            _hud.Health    = _health.Value;
            _hud.Resources = _resources;
            _hud.Tool      = _tool;
            _hud.UpdateWeapon(null);
        }

        // Obstacle container
        _obstacleContainer = GameObject.Find("ObstacleContainer");
    }
Example #27
0
    IEnumerator Healing(Player player, int num, float time) // Poison 데미지 주는 부분만 힐로 바꿈
    {
        int count = 0;

        HUDController HUDcontroller = player.HpHUD.GetComponent <HUDController>();

        HUDcontroller.Status[0].SetActive(true);

        while (player.Hp > 0 && count < num)
        {
            count++;

            player.Hp += heal;

            if (player.Hp > player.InitHp)
            {
                player.Hp = player.InitHp;
            }

            player.HpBarUpdate();

            yield return(new WaitForSeconds(0.5f));
        }
        if (time < EndTime)
        {
            yield break;
        }

        HUDcontroller.Status[0].SetActive(false);
    }
Example #28
0
 public void Init()
 {
     foreach (HUDBaseController HUDController in HUDControllers)
     {
         HUDController.Init();
     }
 }
Example #29
0
 void Start()
 {
     numHP    = hp.GetComponent <TMP_Text>();
     numMP    = mp.GetComponent <TMP_Text>();
     numAP    = ap.GetComponent <TMP_Text>();
     instance = GetComponent <HUDController>();
 }
Example #30
0
    void Awake()
    {
        instance = this;
        PopulateHUDSlots();

        gameOver = transform.FindChild("GameOver").GetComponent<Text>();
    }
Example #31
0
 public void Initialize(HUDController controller, PlayerHealthComponent component)
 {
     this.controller    = controller;
     displayedComponent = component;
     iconDisplay.sprite = displayedComponent.hudIcon;
     displayedComponent.onDeactivation.AddListener(IndicateDeactivation);
 }
    public void Init(Hashtable changeStateData)
    {
        _gameMode = GameMode.COMBAT;

        _playerCombatSystem = _diContainer.Resolve<PlayerCombatSystem>();
        _buildSystem = _diContainer.Resolve<BuildingSystem>();
        _inventorySystem = _diContainer.Resolve<InventorySystem>();
        _enemySystem = _diContainer.Resolve<EnemySystem>();
        _lootSystem = _diContainer.Resolve<LootSystem>();
        _particleGod = _diContainer.Resolve<ParticleGOD>();
        _monsterGenerator = _diContainer.Resolve<MonsterGenerator>();
        
        Singleton.instance.audioSystem.GenerateAudioLookupForLevel();
        _particleGod.InitParticlePool();

        //HUD
        _hudController = new HUDController(_gameConfig.playerConfig,_gameConfig.hudConfig);
        _hudController.Start(() =>
        {
            _monsterGenerator.Init(_hudController, _playerCombatSystem);
        });

        _playerCombatSystem.Init(_hudController);
        _buildSystem.Init();
        _enemySystem.Init();
        _lootSystem.Init();
        _inventorySystem.Init();

        // Get CombatPlayerView
        //_playerCombatSystem.isEnabled = true;
        _dispatcher.AddListener(GameplayEventType.DAMAGE_TAKEN, onDamageTaken);
        _dispatcher.AddListener(GameplayEventType.GAME_COMPLETE, onGameComplete);
        _dispatcher.AddListener(GameplayEventType.GAME_RETRY, onGameRetry);
    }
 private void Start()
 {
     _teamsController = global::TeamsController.Instance;
     _cameraController = global::CameraController.Instance;
     _hudController = global::HUDController.Instance;
     _hudController.UpdateHealthHUD(Health);
     _userController = global::UserController.Instance;
     _userController.SetDead(false);
 }
    // Use this for initialization
    void Start () {
        GameObject hudControllerObject = GameObject.FindGameObjectWithTag("HUDController");
        hudController = hudControllerObject.GetComponent<HUDController>();

        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        gameController = gameControllerObject.GetComponent<GameController>();

        rigid = GetComponent<Rigidbody>();
        playerSpeed = 5.0f;
    }
 /**************************************************
  * Event Handlers
  **************************************************/
 private void Awake()
 {
     if (networkView.isMine == true) {
         _userController = global::UserController.Instance;
         _hudController = global::HUDController.Instance;
         _damage = 10;
         _currentAmmo = 40;
         _fireRate = 0;
         _hudController.AmmoText.text = _currentAmmo.ToString();
     }
 }
    void Start()

    {

        GameObject hudControllerObject = GameObject.FindGameObjectWithTag("HUDController");
        hudController = hudControllerObject.GetComponent<HUDController>();

        StartCoroutine(SpawnWaves());
        StartCoroutine(SpawnEnemy());
        UpdateScore();
    }
    protected override void Awake()
    {
        base.Awake();

        _teamsController = global::TeamsController.Instance;
        _userController = global::UserController.Instance;
        _hudController = global::HUDController.Instance;
        _weaponModels = new List<WeaponModel>(global::WeaponContainer.Instance.WeaponModels);
        _currentWeapon = _weaponModels.First(w => w.Type == WeaponType.Pistol);
        ToggleKey = KeyCode.B;
        ToggleEnabled = true;
    }
Example #38
0
	void Start()
	{
		instance = this;
	}
 /************************************************************
    * Event Handlers
    ************************************************************/
 private void Awake()
 {
     _matchRoundMenuManager = global::MatchRoundMenuManager.Instance;
     _teamsController = global::TeamsController.Instance;
     _spawnController = global::SpawnController.Instance;
     _hudController = global::HUDController.Instance;
     _captureController = global::CaptureController.Instance;
     _userController = global::UserController.Instance;
 }
Example #40
0
	void Awake()
	{
		instance = this;

		UpdateResources();
	}
	/// <summary>
	/// Initialization after loading
	/// </summary>
	void Awake()
	{

		mBestScore.Score = 0;
		InitStats();
		mCameraTransf = Camera.main.transform;
		mCameraHWidth = Camera.main.aspect * Camera.main.orthographicSize;
		mCameraWidth = mCameraHWidth * 2;
		mPlayerTransf = gameObject.transform;
		mHUDController = GameObject.Find("HUD").GetComponent<HUDController>();
		mPlayerMarker = mPlayerTransf.Find("Marker").gameObject;
		mBubbleShield = mPlayerTransf.Find("BubbleShield").gameObject;
		mAnimator = GetComponent<Animator>();
		mRigidBody = GetComponent<Rigidbody2D>();

		// Background
		GameObject bg = GameObject.Find("Background1");
		mBGSpriteRenderer1 = bg.GetComponent<SpriteRenderer>();
		Vector2 bgSourceSize = mBGSpriteRenderer1.sprite.bounds.size;
		// BG 1
		mBackgroundTransform1 = bg.GetComponent<Transform>();
		// BG 2
		mBackgroundTransform2 = GameObject.Find("Background2").GetComponent<Transform>();
		mBGSpriteRenderer2 = mBackgroundTransform2.GetComponent<SpriteRenderer>();
		// BG Scale
		mBackgroundTransform1.localScale = mBackgroundTransform2.localScale =
				new Vector3(mCameraWidth / bgSourceSize.x, Camera.main.orthographicSize * 2 / bgSourceSize.y, 1);
		// BG Position
		sHelperVector3.Set(mCameraTransf.localPosition.x * FarParallaxFactor, 0, 10);
		mBackgroundTransform2.localPosition = sHelperVector3;
		sHelperVector3.x -= mCameraWidth;
		mBackgroundTransform1.localPosition = sHelperVector3;

		// Highscores
		mHighscoreMgr = GameObject.Find("GameData").GetComponent<HighscoreManager>();
		mHighscoreMgr.OnScoreListUpdated = OnHighscoreListUpdated;

		// Update HUD
		mHUDController.SetCoins(Coins);
		mHUDController.SetMeters(0);

		mCameraPosition = mCameraTransf.localPosition;
		mCameraPosition.x = mPlayerTransf.localPosition.x + CameraXOffset;
		mCameraTransf.localPosition = mCameraPosition;
	}
Example #42
0
	// Use this for initialization
	void Awake () {
		instance = this;
	}
 public static void Reset()
 {
     _instance = null;
 }
Example #44
0
 void Awake()
 {
     player = GameObject.Find ("Player");
     playerController = player.GetComponent<PlayerController> ();
     spacebar = GameObject.Find ("PressSpaceBarText").GetComponent<Text> ();
     HUD = GameObject.Find ("HUDCanvas").GetComponent<HUDController> ();
     anim_gameOver = GameObject.Find ("HUDCanvas").GetComponent<Animator> ();
     bgController = BGObject.GetComponent<BGPlayerScript>();
 }
 protected void Awake()
 {
     hudController = this;
 }