예제 #1
0
    void OnCollisionEnter(Collision collision)
    {
        if (GetComponent <NetworkView>().isMine)
        {
            if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Player")
            {
                Debug.Log("Hit player");
                HealthbarTextScript enemyHealth = collision.gameObject.GetComponent <HealthbarTextScript>();

                enemyHealth.GetComponent <NetworkView>().RPC("TakeDamage", RPCMode.Others, Damage, player.nameofPlayer);
            }
            //PoolManager.Instance.Destroy(gameObject);
            Network.Destroy(gameObject);
        }
    }
예제 #2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "matches")
     {
         Debug.Log("Destroying matches");
         Destroy(collision.gameObject);
     }
     if (collision.gameObject.tag == "Player")         //change to player
     {
         HealthbarTextScript enemyHealth = collision.gameObject.GetComponent <HealthbarTextScript>();
         enemyHealth.GetComponent <NetworkView>().RPC("TakeDamage", RPCMode.Others, Damage, player.nameofPlayer);
     }
     //PoolManager.Instance.Destroy(gameObject);
     Network.Destroy(gameObject);
 }