Exemplo n.º 1
0
    public void Hit()
    {
        //Debug.Log("Hit: " + the_collision.transform.name);
        IHealthPool hithealth = the_collision.transform.GetComponent <IHealthPool>();

        if (hithealth != null)
        {
            //Debug.Log("Damaged: " + the_collision.transform.name);
            hithealth.Damage(PulseDamage);
        }
        Vector3 spawn_point = the_collision.contacts[0].point;

        Despawn();
    }
Exemplo n.º 2
0
    public void Hit()
    {
        Debug.Log("Hit: " + the_collision.transform.name);
        IHealthPool hithealth = the_collision.transform.GetComponent <IHealthPool>();

        if (hithealth != null)
        {
            Debug.Log("Damaged: " + the_collision.transform.name);
            hithealth.Damage(RocketDamage);
        }
        Vector3    spawn_point = the_collision.contacts[0].point;
        GameObject decal       = Instantiate(ExplosionDecal);

        decal.transform.position = spawn_point;
        decal.transform.parent   = null;
        Despawn();
    }
Exemplo n.º 3
0
    public void Launch(Vector3 position, Vector3 direction)
    {
        RaycastHit rayhit;

        //look into collision layers
        directionVec = direction;
        bool hit = Physics.Raycast(transform.position, directionVec, out rayhit);


        if (hit)
        {
            Vector3     rayposition = rayhit.point;
            IHealthPool hithealth   = rayhit.transform.GetComponent <IHealthPool>();
            if (hithealth != null)
            {
                hithealth.Damage(BulletDamage);
            }
            GameObject decal = Instantiate(BulletHoleDecal);

            decal.transform.position = rayposition;
        }
        StartCoroutine(despawn());
    }