Example #1
0
    // Use this for initialization
    void Start()
    {
        timer = 0;
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        behaviorScript = player.GetComponent <IronManBehaviorScript> ();
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        startingPoint = GameObject.Find("starting-point");
        endingPoint   = GameObject.Find("ending-point");
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        behaviorScript = player.GetComponent <IronManBehaviorScript> ();
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     anim = GetComponent <Animator> ();
     //player = GameObject.FindGameObjectWithTag ("Player");
     enemyHealth    = GetComponent <EnemyHealth> ();
     playerHealth   = player.GetComponent <PlayerHealth> ();
     agent          = GetComponent <UnityEngine.AI.NavMeshAgent> ();
     playerShoot    = player.GetComponent <PlayerShoot> ();
     playerMovement = player.GetComponent <IronManBehaviorScript> ();
 }
Example #4
0
    public void TakeDamage(int amount, Vector3 hitPoint)
    {
        // we need to find out if the enemy is already or not
        if (isDead)
        {
            return;
        }

        currentHealth -= amount;
        hitParticles.transform.position = hitPoint;
        hitParticles.Play();
        if (currentHealth <= 0)
        {
            GameObject            player       = GameObject.FindGameObjectWithTag("Player");
            IronManBehaviorScript playerScript = player.GetComponent <IronManBehaviorScript> ();
            //	playerScript.score += pointValueOnKill;
            audio.PlayOneShot(scoreUp, 1.0f);
            Death();
        }

        int randomNumber = Random.Range(1, 3);

        switch (randomNumber)
        {
        case 1:
            audio.PlayOneShot(hurt1, 0.3f);
            break;

        case 2:
            audio.PlayOneShot(hurt2, 0.3f);
            break;

        case 3:
            audio.PlayOneShot(hurt3, 0.3f);
            break;
        }
    }