Ejemplo n.º 1
0
    void OnTriggerEnter(Collider traveler)
    {
        if (traveler.tag == "Player" && isEnabled && Time.time - cooldown > 0.5f)
        {
            traveler.transform.position = destination;
            unit_health playerhp = traveler.GetComponent <unit_health>();

            exitScript.cooldown = Time.time;

            playerhp.spawnPosition = destination;
        }
    }
Ejemplo n.º 2
0
    void OnTriggerStay(Collider target)
    {
        if (transform.parent.gameObject.layer.Equals(8) && target.gameObject.layer.Equals(9) || transform.parent.gameObject.layer.Equals(9) && target.gameObject.layer.Equals(8))
        {
            unit_health targetHealth = target.gameObject.GetComponent <unit_health>();
            targetHealth.Damage(damage);

            Debug.Log(transform.parent.name + " -> " + damage + " DMG -> " + target.name);

            sphereCol.enabled = false;
            done = true;
        }
    }