Example #1
0
    public void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Colleccionable") && PV.IsMine)
        {
            Debug.Log("Transportar colleccionable a constructor");

            Colleccionable colleccionable = collision.gameObject.GetComponent <Colleccionable>();
            colleccionable.parent.estaOcupat = false;
            ConstructorController constructor = FindObjectOfType <ConstructorController>();
            constructor.EnviarColleccionable(colleccionable.color);
            //PV.RPC("RPC_destroyColleccionable", RpcTarget.All, collision.gameObject as Object);

            int index = rc.indexColleccionable(collision.gameObject);
            if (index == -1)
            {
                Debug.LogError("Fail");
            }
            rc.deleteColleccionable(index);

            //Destroy(collision.gameObject);
        }
        else if (collision.gameObject.CompareTag("Bullet") && vides > 0)
        {
            vides--;
            Destroy(collision.gameObject);
        }
    }
Example #2
0
 public void NouColleccionable(Colleccionable nouColleccionable)
 {
     if (colleccionable != null)
     {
         Destroy(colleccionable);
     }
     colleccionable = Instantiate(nouColleccionable.gameObject,
                                  creadorColleccionables.transform.position, Quaternion.identity, creadorColleccionables.transform);;
 }
Example #3
0
    public int indexColleccionable(GameObject colleccionable)
    {
        int            i = 0;
        Colleccionable c = colleccionable.GetComponent <Colleccionable>();

        foreach (ColleccionableCreators index in creators)
        {
            //GameObject fill = index.gameObject.GetComponentInChildren<Colleccionable>().gameObject;
            if (index == c.parent)
            {
                return(i);
            }
            i++;
        }
        return(-1);
    }
Example #4
0
 public bool esCollecicionableCorrecte(Colleccionable colleccionable)
 {
     Debug.Log("real=" + colleccionable.color + ". Hauria + " + llista[index].color);
     return(colleccionable.color.Equals(llista[index].color));
 }
Example #5
0
 public void Instantiate(Colleccionable col)
 {
     col.parent = this;
     Instantiate(col, transform.position, Quaternion.identity, transform);
     estaOcupat = true;
 }