Beispiel #1
0
    void Update()
    {
        transform.LookAt(GameObject.Find("Player").transform.position);

        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            if (prevObjName != "Player" && hit.collider.gameObject.name == "Player")
            {
                playerHealth.health--;
                camshake.TriggerShake();
            }

            prevObjName = hit.collider.gameObject.name;
        }
    }