Example #1
0
    void OnTriggerEnter(Collider col)
    {
        AttachArrow();

        //Debug.Log("collided");
        if (col.GetComponent <EnemyStats>())
        {
            if (isFired)
            {
                this.GetComponent <Collider>().isTrigger = false;
            }
            EnemyStats enemyStats = col.GetComponent <EnemyStats>();
            enemyStats.Hit(damage);
            PlayerStats playerStats = col.GetComponent <PlayerStats>();
            playerStats.Hit(damage);



            //PARTICLE EFFECT
            // GameObject impactGO = Instantiate(impactEffect, arrowspawn.position, Quaternion.LookRotation(arrowspawn.forward));
            // Destroy(impactGO, 0.1f);
        }
        else if (col.GetComponent <GameStarter>())
        {
            if (isFired)
            {
                this.GetComponent <Collider>().isTrigger = false;
            }
            GameStarter starter = col.GetComponent <GameStarter>();
            starter.StartLevel();
        }
    }