Exemplo n.º 1
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 <PlayerBehaviorScript>();
 }
Exemplo n.º 2
0
    protected void InitializeData()
    {
        thisNpcBehavior    = theNpc.GetComponent <NpcBehaviorScript>();
        thisPlayerBehavior = thePlayer.GetComponent <PlayerBehaviorScript>();

        thisGoemonEye = theGoemonEye.GetComponent <EyeBlinkingScript>();
        thisFujikoEye = theFujikoEye.GetComponent <EyeBlinkingScript>();

        thisPlayerBoxScript = thisPlayerDialogBox.GetComponent <InGameDialogScript>();
        thisNpcBoxScript    = thisNpcDialogBox.GetComponent <InGameDialogScript>();
    }
Exemplo n.º 3
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");
            PlayerBehaviorScript playerScript = player.GetComponent <PlayerBehaviorScript>();
            playerScript.score += pointValueOnKill;

            Death();
        }
    }
Exemplo n.º 4
0
    public void TakeDamage(int amount, Vector3 hitPoint)
    {
        // Is object is destroyed or not
        if (D == true)
        {
            return;
        }

        if (D == false)
        {
            currentHealth -= amount;
            hitParticles.Play();
        }

        if (currentHealth <= 0)
        {
            GameObject           player       = GameObject.FindGameObjectWithTag("Player");
            PlayerBehaviorScript playerScript = player.GetComponent <PlayerBehaviorScript>();
            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;
        }
    }
Exemplo n.º 5
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");
            PlayerBehaviorScript playerScript = player.GetComponent <PlayerBehaviorScript>();
            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;
        }
    }
 protected void InitializePlayerAsOpponent()
 {
     thisPlayerBehavior = thePlayer.GetComponent <PlayerBehaviorScript>();
 }
    void Update()
    {
        if (isDead)
        {
            Vector3 position = transform.position += Vector3.up * 10;

            GameObject           inst         = (GameObject)Instantiate(explo, position, Quaternion.identity);
            GameObject           inst2        = (GameObject)Instantiate(junk, position, Quaternion.identity);
            GameObject           player       = GameObject.FindGameObjectWithTag("Player");
            PlayerBehaviorScript playerScript = player.GetComponent <PlayerBehaviorScript>();

            Destroy(gameObject);
            playerScript.score += pointValueOnKill;
            return;
        }

        if (state == State.scanning)
        {
            light.SetActive(false);
            light2.SetActive(false);
            foreach (GameObject elem in spawners)
            {
                // print(elem);

                if (elem != null)
                {
                    elem.transform.Find(name: "SpawnPortal").gameObject.SetActive(false);
                    elem.GetComponent <SpawnEnemyScript>().enabled = false;
                }
            }

            scanning();
        }
        else if (state == State.tracking)
        {
            light.SetActive(true);
            light2.SetActive(false);

            if (state == State.tracking)
            {
                timer += Time.deltaTime * 1;

                if (timer >= delay / 2)
                {
                    light2.SetActive(true);
                }

                if (timer >= delay)
                {
                    light2.SetActive(true);
                    audio.PlayOneShot(laser, 0.3f);
                    fire.Play();
                    //GameObject inst4 = (GameObject)Instantiate(fire, transform.position, Quaternion.identity);
                    timer = 0;
                }

                foreach (GameObject elem in spawners)
                {
                    if (elem != null)
                    {
                        {
                            elem.transform.Find("SpawnPortal").gameObject.SetActive(true);
                            elem.GetComponent <SpawnEnemyScript>().enabled = true;
                        }
                    }
                }

                //GameObject.Find("SPAWNER").GetComponent<SpawnEnemyScript>().enabled = true;
                //gameObject.GetComponent<SpawnEnemyScript>().enabled = true;
                tracking();
            }
        }
    }
Exemplo n.º 8
0
 protected void FindPlayerBehavior()
 {
     thisPlayerBehaviorScript = GameObject.Find("PlayerBehavior").GetComponent <PlayerBehaviorScript>();
 }