Inheritance: MonoBehaviour
 private void Awake()
 {
     hudScript = GameObject.FindGameObjectWithTag("HUD").GetComponent<HUDScript>();
     SetID();
     m_itemUI.SetActive(false);
     SetUpUI();
 }
Exemple #2
0
    /*
     * private void Animation(){
     *      if(ai.lifeState == Ai.LIFE_STATE.IsAlive){
     *              if(ai.moveState != Ai.MOVEMENT_STATE.IsIdle){
     *                      anim.SetBool(animPatrol, true);
     *              } else {
     *                      anim.SetBool(animPatrol, false);
     *              }
     *
     *      } else if(ai.lifeState == Ai.LIFE_STATE.IsDead){
     *              anim.SetBool(animDeath, true);
     *      }
     * }
     */
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "hitbox")
        {
            AudioSource.PlayClipAtPoint(death, transform.position);
            anim.Play("deathGuard");

            hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
            hud.IncreaseScore(2000);
            Destroy(GetComponent <Rigidbody>());
            Destroy(GetComponent <Collider>());
            Destroy(GetComponent <Ai>());
            //enemy.collider.enabled = false;
            //yield return new WaitForSeconds(2f);
            Destroy(gameObject, 3f);
        }

        if (other.gameObject.tag == "Destructible")
        {
            AudioSource.PlayClipAtPoint(death, transform.position);
            anim.Play("deathGuard");

            hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
            hud.IncreaseScore(2000);
            Destroy(GetComponent <Rigidbody>());
            Destroy(GetComponent <Collider>());
            Destroy(GetComponent <Ai>());
            //enemy.collider.enabled = false;
            //yield return new WaitForSeconds(2f);
            Destroy(gameObject, 2f);
        }
    }
Exemple #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        score = GetComponent <HUDScript> ();

        if (other.tag == "Player")
        {
            Back.SetActive(true);
            Button.SetActive(true);
            Kalah.SetActive(true);
            Score.SetActive(false);
            main.Stop();
            end.Play();
            //score.LastScore ();


            Time.timeScale = 0;


            //Debug.Break ();
            return;
        }
        else if (other.gameObject.transform.parent)
        {
            Destroy(other.gameObject.transform.parent.gameObject);
        }
        else
        {
            Destroy(other.gameObject);
        }
    }
	// Use this for initialization
	void Start () {
		GameObject hudObject = GameObject.FindGameObjectWithTag("Player");
		GameObject managerObject = GameObject.FindGameObjectWithTag("GameController");
		
		gameManager = managerObject.GetComponent<GameManagerScript>();
		hudScript = hudObject.GetComponent<HUDScript>();
	}
Exemple #5
0
 private void Awake()
 {
     hud          = GameObject.FindObjectOfType <Camera>().GetComponent <HUDScript>();
     audioSource  = GetComponent <AudioSource>();
     rend         = GetComponent <Renderer>();
     rend.enabled = true;
 }
 // Use this for initialization
 void Start()
 {
     rb          = GetComponent <Rigidbody>();
     audioSource = gameObject.GetComponent <AudioSource>();
     hudScript   = FindObjectOfType <HUDScript>();
     sprintmeter = sprintMax;
 }
Exemple #7
0
 private void gameTimerCountdown()
 {
     //update timer
     if (gameTimer < 300)
     {
         gameTimer += 1;
         int sec = gameTimer % 60;
         Timer.text = "" + gameTimer / 60;
         if (sec < 10)
         {
             Timer.text += ":0" + gameTimer % 60;
         }
         else
         {
             Timer.text += ":" + gameTimer % 60;
         }
     }
     foreach (team t in securedObjectives)
     {
         if (t == team.blue)
         {
             AddBluePoints(1, "objective");
         }
         else if (t == team.red)
         {
             AddRedPoints(1, "objective");
         }
     }
     HUDScript.updatePoints();
 }
 // Use this for initialization
 void Start()
 {
     agent          = GetComponent <NavMeshAgent> ();
     mainPlayer     = GameObject.FindWithTag("MainPlayer");
     hud            = GameObject.FindObjectOfType(typeof(HUDScript)) as HUDScript;
     returnPosition = agent.transform.position;
 }
	void OnTriggerEnter2D (Collider2D other) {
		if (other.tag == "Player") {
			hud = GameObject.Find("Score Text").GetComponent<HUDScript>();
			hud.IncreaseScore (-2);
			Destroy (this.gameObject);
		}
	}
Exemple #10
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         HUD = GameObject.FindWithTag("HudManager").GetComponent <HUDScript>();
         HUD.removeLife(1, collision.gameObject);
     }
 }
Exemple #11
0
 /// <summary>
 /// Destroys the block on collision with a ball
 /// </summary>
 /// <param name="coll">Coll.</param>
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.CompareTag("Ball"))
     {
         HUDScript.AddPoints();
         Destroy(gameObject);
     }
 }
Exemple #12
0
 private void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
 //public HUDScript hudCanvas;
 // Start is called before the first frame update
 void Start()
 {
     hs        = GameObject.Find("obvious").GetComponent <HUDScript>();
     rigidBody = this.GetComponent <Rigidbody2D>();
     rigidBody.gravityScale = 1.0f;
     GetComponent <AudioSource>().playOnAwake = false;
     sc = score.GetComponent <ScoreControl>();
 }
Exemple #14
0
    public void IncreaseMaxHP(int amount)
    {
        HUDScript hud = GameObject.Find("HUD").GetComponent <HUDScript>();

        maxHP++;
        curHP = maxHP;
        hud.RefreshHearts();
    }
Exemple #15
0
    private void Start()
    {
        rBody = GetComponent <Rigidbody>();

        HUD             = HUDScript.Instance;
        layerMaskInvert = 1 << gameObject.layer; //set layer mask to car's layer
        layerMaskInvert = ~layerMaskInvert;      // invert layer mask
    }
Exemple #16
0
 void Start()
 {
     hud             = hudPanel.GetComponent <HUDScript>();
     blackFadeScreen = blackScreenPanel.GetComponent <BlackFadeScreen>();
     victoryScreen   = victoryScreenPanel.GetComponent <VictoryScreen>();
     gameOverScreen  = gameOverPanel.GetComponent <GameOverScreen>();
     pauseMenu       = pausePanel.GetComponent <PauseMenu>();
 }
	void OnTriggerEnter2D(Collider2D other) {
		if (other.tag == "Player") {
			SoundManagerScript.instance.RandomisePowerUpSfx(0.6f, coinSound);
			// inefficient, pull it once, put on spawn object, pass it onto children
			hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
			hud.IncreaseScore (10);
			Destroy (this.gameObject);
		}
	}
Exemple #18
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
         hud.IncreaseScore(10);
         Destroy(this.gameObject);
     }
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         HUD = GameObject.FindObjectOfType<HUDScript>();
         HUD.IncrementarPontuacao(10);
         Destroy(this.gameObject);
     }
 }
    private void Start()
    {
        // groundDetection = GameObject.Find("GroundDetection").transform.GetChild(0);
        groundDetection = gameObject.transform.GetChild(0);
        // fovAngle = fovAngle * Mathf.Deg2Rad;

        _gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        hud          = GameObject.FindGameObjectWithTag("Hud").GetComponent <HUDScript>();
    }
 void Awake()
 {
     //hud = GameObject.GetComponent<HUDScript>();
     hud = GameObject.FindObjectOfType(typeof(HUDScript)) as HUDScript;
     //m_someOtherScriptOnAnotherGameObject.Test();
     agent      = GetComponent <NavMeshAgent> ();
     mainPlayer = GameObject.FindWithTag("MainPlayer");
     //agent.
 }
Exemple #22
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.tag == "Player"){
            //may be inificiant
            hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();

            hud.UpdateScore(10);
            Destroy(this.gameObject);
        }
    }
Exemple #23
0
    // Start is called before the first frame update
    void Start()
    {
        counting           = false;
        numOfRoadsTouching = 0;
        score = startingScore;

        hud = FindObjectOfType <HUDScript>();

        cameras = FindObjectsOfType <Camera>();
    }
Exemple #24
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
         gameObject.renderer.enabled = false;
         hud.IncreaseScore(500);
         Destroy(this.gameObject, 2);
     }
 }
Exemple #25
0
    // Use this for initialization
    void Start()
    {
        bulletScript = bullet.GetComponent <BulletScript> ();

        HUD       = GameObject.FindGameObjectWithTag("Hud");
        hudScript = HUD.GetComponent <HUDScript> ();

        enemySpawner       = GameObject.FindGameObjectWithTag("EnemySpawner");
        enemySpawnerScript = enemySpawner.GetComponent <EnemySpawnerScript> ();
    }
Exemple #26
0
    void OnBecameInvisible()
    {
        if (!deathTimer.Finished && transform.position.y - halfColliderHeight < ScreenUtils.ScreenBottom)
        {
            Camera.main.GetComponent <BallSpawner>().SpawnBall();
        }

        HUDScript.ReduceBalls();
        Destroy(gameObject);
    }
 void OnTriggerEnter2D(Collider2D other)
 {
     HUDCamera = GameObject.FindGameObjectWithTag("MainCamera");
     if (other.tag == "Player")
     {
         HUDScript HUD = HUDCamera.GetComponent <HUDScript>();
         HUD.inscreaseScore(bonusValue);
         Destroy(this.gameObject);
     }
 }
Exemple #28
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
         hud.IncreaseScore(5000);
         Application.LoadLevel(4);
         return;
     }
 }
 // Start is called before the first frame update
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         HUD = GameObject.FindWithTag("HudManager").GetComponent <HUDScript>();
         HUD.increaseScore(1);
         HUD.addCoins(1);
         Destroy(this.gameObject);
     }
 }
 // Use this for initialization
 void Start()
 {
     if (!playerController)
     {
         playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControllerIk>();
     }
     if (!mHUD)
     {
         mHUD = transform.FindChild("HUDCanvas").gameObject.GetComponent <HUDScript>();
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            hud = GameObject.Find("_ScoreHandler").GetComponent <HUDScript> ();
            hud.IncreaseScore(1000);

            {
            }
        }
    }
 private void Awake()
 {
     if (HUDSingleton == null)
     {
         HUDSingleton = this;
     }
     else
     {
         Destroy(this);
     }
 }
Exemple #33
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player") {
            hud = GameObject.Find ("Main Camera").GetComponent<HUDScript>(); //fix inefficiant
            //better to pull it one time and have it on the spawn object and have it on the children
            //
            hud.IncreaseScore (10);
            Destroy (this.gameObject);

        }
    }
Exemple #34
0
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log("other.tag: " + other.tag);

        if (other.tag == "Player")
        {
            hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
            hud.IncreaseScore(50000);
            //Debug.Log("playerScore: " + hud.playerScore);
            Destroy(this.gameObject);
        }
    }
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log("other.tag: " + other.tag);

        if (other.tag == "Player")
        {
            hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
            hud.IncreaseScore(50000);
            //Debug.Log("playerScore: " + hud.playerScore);
            Destroy(this.gameObject);
        }
    }
Exemple #36
0
 private void Awake()
 {
     if (HUDInstance == null)
     {
         HUDInstance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #37
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         DestroyObject(gameObject);
     }
     DontDestroyOnLoad(this);
 }
    void OnTriggerEnter(Collider other)
    {
        PlayerPhysics physics = other.gameObject.GetComponent <PlayerPhysics>();

        if (physics)
        {
            hud = GameObject.Find("Main Camera").GetComponent <HUDScript>();
            hud.IncreaseScore(5000);
            Application.LoadLevel(2);
            return;
        }
    }
Exemple #39
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if(other.tag == "Player")
     {
         hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
         hud.IncreaseScore(-5);
         Destroy(this.gameObject);
     }
     if (this.tag == "PosShot")
     {
         hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
         hud.IncreaseScore(10);
         Destroy(this.gameObject);
     }
 }
Exemple #40
0
    void Start()
    {
        networkManager = GetComponent<NetworkManagerScript>();
        mainMenu = GetComponent<MainMenuScript>();
        gameManager = GetComponent<GameManagerScript>();
        playerData = GetComponent<PlayerDataScript>();
        menuManager = GetComponent<MenuManager>();
        hud = GetComponent<HUDScript>();
        chatRoom = GetComponent<ChatRoomScript>();

        // column rects			Horizontal start		Vert Start		Width					Height
        firstCol = new Rect(	12,						 50,		Screen.width/3 - 18,	Screen.height - 50);
        secCol = new Rect(		Screen.width/3 + 6,		 50,		Screen.width/3 - 68, 	Screen.height - 50);
        thirdCol = new Rect(	2*Screen.width/3 - 44,	 50,		Screen.width/3 + 32, 	Screen.height - 50);

        //the list of teams, as strings
        List<Team> teams = Team.GetTeamList();
        teamList = new string[teams.Count];
        for(int x = 0; x < teams.Count; x++)
        {
            teamList[x] = teams[x].name;
        }
    }
 void Start()
 {
     _HUDScript = GameObject.Find( "HUD" ).GetComponent< HUDScript >();		// Get the player script to check the health of player
     _PlayerSettingsScript = GameObject.Find( "PlayerSettings" ).GetComponent< PlayerSettingsScript >();
     spawnEnemies = true;
     xMin = 25;
     xMax = Screen.width;
     GetEnemiesToSpawn();
     StartCoroutine( "SpawnEnemies" );
 }
    private HUDScript hudScript;//remove? doesn't look like it's being used

    private void Awake()
    {
        hudScript = GameObject.FindGameObjectWithTag("HUD").GetComponent<HUDScript>();//remove? doesn't look like it is being used 
        m_itemUI.SetActive(false);
    }
    void Start()
    {
        GameMaster.CurrentState = GameMaster.GameState.PLAYER_TURN;
        camNullScript = Camera.main.gameObject.transform.parent.GetComponent<IsoCamera>();
        nextPosition = curPosition = transform.position;
        // Force player to grid
        transform.position = new Vector3(Mathf.Floor(transform.position.x), 0f, Mathf.Floor(transform.position.z));
        gridPlanes = new ArrayList();

        // Initialize player stats...
        curr_Health = max_Health; //set player to maximum health
        //curr_Cargo = max_Cargo; //set cargo to maximum capacity
        //InvokeRepeating("decreaseHealth", 1f, 1f); just for testing purposes, this decreases health by 2 every second
        //SetCargoBar(curr_Cargo);

        GameObject HUD = GameObject.FindGameObjectWithTag("HUD");
        hudScript = HUD.GetComponent<HUDScript>();
        audio = gameObject.AddComponent<AudioSource>();
        empSound   = gameObject.AddComponent<AudioSource>();
        empSound.clip   = AudioController.effect[2];

        switch (SpawnMaster.CURRENT_STATE)
        {
            case (SpawnMaster.SpawnState.SMALL):
                {
                    max_Cargo = SpawnMaster.SMALL_CARGO;
                }
                break;
            case (SpawnMaster.SpawnState.MEDIUM):
                {
                    max_Cargo = SpawnMaster.MEDIUM_CARGO;
                }
                break;
            case (SpawnMaster.SpawnState.LARGE):
                {
                    max_Cargo = SpawnMaster.LARGE_CARGO;
                }
                break;
        }

    }
 void Awake()
 {
     hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
 }
    // Use this for initialization
    void Awake()
    {
        score = new List<PlayerScoreInfo>();
        GameObject game = GameObject.FindGameObjectWithTag("GameController");
        hud = game.GetComponent<HUDScript>();
        scoreMenu = game.GetComponent<ScoreMenuScript>();
        gameManager = game.GetComponent<GameManagerScript>();
        spawnManager = game.GetComponent<SpawnManagerScript>();

        hud.RegisterScoreKeeper(this);
        scoreMenu.RegisterScoreKeeper(this);
        gameManager.RegisterScoreKeeper(this);
        spawnManager.RegisterScoreKeeper(this);

        ResetScore();
    }
	// Use this for initialization
	void Start ()
    {
        press = pause = change = false;
        HUD = gameObject.GetComponent<HUDScript>();
    }
Exemple #47
0
 // Use this for initialization
 void Start()
 {
     nextMenu = PauseMenuNextMenu.NONE;
     networkManager = GetComponent<NetworkManagerScript>();
     gameManager = GetComponent<GameManagerScript>();
     settings = GetComponent<SettingsMenu>();
     mainMenu = GetComponent<MainMenuScript>();
     lobby = GetComponent<GameLobbyScript>();
     hud = GetComponent<HUDScript>();
 }
Exemple #48
0
 //    TutorialScript tuts;
 void Start()
 {
     hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
     //		tuts = GameObject.Find ("Canvas Text").GetComponent<TutorialScript> ();
     audio = GetComponent<AudioSource>();
 }
    void Awake()
    {
        jumpCount = totalJumps = GameSettings.standardJumpCount;
        abilities = new List<Ability>();

        GameObject game = GameObject.FindGameObjectWithTag("GameController");
        hud = game.GetComponent<HUDScript>();
        scoreMenu = game.GetComponent<ScoreMenuScript>();
        networkManager = game.GetComponent<NetworkManagerScript>();
        playerData = game.GetComponent<PlayerDataScript>();
        nameDisplay = transform.Find("CharacterNameDisplay").GetComponent<CharacterNameDisplayScript>();
    }
Exemple #50
0
 void Start()
 {
     networkManager = GetComponent<NetworkManagerScript>();
     mainMenu = GetComponent<MainMenuScript>();
     hud = GetComponent<HUDScript>();
     pause = GetComponent<PauseMenuScript>();
 }
Exemple #51
0
 void OnEnable()
 {
     instance = this;
 }