示例#1
0
 private void Start()
 {
     agent = this.GetComponent <NavMeshAgent>();
     //colliderTrigger.GetComponent<BossColliderTrigger>().OnPlayerEnterTrigger += ColliderTrigger_OnPlayerEnterTrigger;
     bossHealth = enemyBoss.GetComponent <npcHealth>();
     //atkTimer = Random.Range(5, 10);
     StartBattle();
 }
示例#2
0
 //[PROGRAMMER] nQ's Script [PROGRAMMER]
 void Awake()
 {
     Health           = this.GetComponent <npcHealth> ();
     Health.initialHP = defaultHP;
     Health.Alive     = true;
 }
示例#3
0
    private void OnTriggerEnter(Collider collision)
    {
        //Debug.Log(collision.name);
        //Debug.Log("Hit: " + collision.name); --> use this to check to see what the bullet is actually hitting
        //probably find a wayto do this without assigning a variable each time this spawns if we need to optimize the script in the future
        if ((collision.gameObject.tag == "Corrupted_Player") && (collision.gameObject != CurrentPlayer))
        {
            // VFX
            GameObject impactPoint = collision.gameObject.transform.Find("SpawnImpactVFX").gameObject;
            Instantiate(impactVFX, impactPoint.transform.position, impactPoint.transform.rotation);

            //Health hp = collision.gameObject.GetComponent<Health>();
            if (collision.gameObject.GetComponent <Health>())
            {
                Debug.Log("Bullet doing damage");
                collision.gameObject.GetComponent <Health>().TakeDamage(dmg, type, DOT);
            }
            Destroy(this.gameObject, destroyTimer);
        }
        if ((collision.gameObject.tag == "Player") && (collision.gameObject != CurrentPlayer))
        {
            //Health hp = collision.gameObject.GetComponent<Health>();
            if (CurrentPlayer.tag == "Corrupted_Player")
            {
                // VFX
                // if(collision.gameObject.transform.Find("SpawnImpactVFX").gameObject != null){
                //     GameObject impactPoint = collision.gameObject.transform.Find("SpawnImpactVFX").gameObject;
                //     Instantiate(impactVFX, impactPoint.transform.position, impactPoint.transform.rotation);
                // }

                // if(collision.gameObject.GetComponent<Health>()){
                //     Debug.Log("Bullet doing damage");
                //     collision.gameObject.GetComponent<Health>().TakeDamage(dmg, type, DOT);
                // }
            }
            Destroy(this.gameObject, destroyTimer);
        }
        if ((collision.gameObject.tag == "EnemyHitbox") && (collision.gameObject != CurrentPlayer))
        {
            // VFX
            if (collision.gameObject.transform.Find("SpawnImpactVFX").gameObject != null)
            {
                GameObject impactPoint = collision.gameObject.transform.Find("SpawnImpactVFX").gameObject;
                Instantiate(impactVFX, impactPoint.transform.position, impactPoint.transform.rotation);
            }

            npcHealth hp = collision.gameObject.GetComponent <npcHealth>();
            //Debug.Log(hp);
            if (hp)
            {
                hp.TakeDamage(dmg, type, DOT, isCrit);
            }

            Destroy(this.gameObject, destroyTimer);
        }

        else if ((collision.gameObject.tag == "Boss") && (collision.gameObject != CurrentPlayer))
        {
            // VFX
            GameObject impactPoint = collision.gameObject.transform.Find("SpawnImpactVFX").gameObject;
            Instantiate(impactVFX, impactPoint.transform.position, impactPoint.transform.rotation);

            npcHealth hp = collision.gameObject.GetComponent <npcHealth>();
            //Debug.Log(hp);
            if (hp)
            {
                hp.TakeDamage(dmg, type, DOT, isCrit);
            }

            Destroy(this.gameObject, 0);
        }

        else if (collision.gameObject.tag == "Bullet" || collision.gameObject.tag == "EditorOnly" || collision.gameObject.tag == "Untagged")
        {
            ;
        }
        // destroy if it collides with anything else
        // else if(collision.gameObject.tag == "Untagged"){
        //     Debug.Log("Tag: " + collision.gameObject.tag);
        //     Debug.Log("Name: " + collision.gameObject.name);
        //     Destroy(this.gameObject);
        // }
    }