Esempio n. 1
0
    void OnTriggerEnter(Collider collision)
    {
        if (Schuetze == null)
        {
            Schuetze = FindStatus(collision.transform);
        }

        //Debug.Log("Schuetze status: " + Schuetze);
        //Debug.Log("OnTriggerEnter status: " + collision.transform.parent.GetComponent<status>());
        if (collision.tag == "Player" && !hit)
        {
            status ColliderStatus = FindStatus(collision.transform);
            if (ColliderStatus == null)
            {
                Debug.Log("Player Without Collider Error!!!!!");
            }


            if (ColliderStatus != Schuetze ||
                ColliderStatus == Schuetze && leftPlayer)
            {
                if (friendlyfire && ColliderStatus != Schuetze ||
                    !friendlyfire)
                {
                    ColliderStatus.RpcTakeDamage();
                    Schuetze.score += 1;
                    //Debug.Log("Player took damage: " + ColliderStatus.GetInstanceID() + " he was hit at: " + collision.name + " , Time: "+ Time.time);
                    DestroyObject(transform.gameObject);
                    hit = true;
                }
            }
        }

        /* else if(collision.tag == "Player" && hit)
         * {
         *   Debug.Log("DoubleHit prevented: " + FindStatus(collision.transform).GetInstanceID() + " he was hit at: " + collision.name + " , Time: " + Time.time);
         * }*/
    }