Exemple #1
0
 private void AddItem(Collision2D collision, string clone)
 {
     for (int i = 0; i < trashPrefabs.Length; i++)
     {
         if (collision.transform.name == trashPrefabs[i].name + clone)
         {
             print(transform.name + " Pick up : " + trashPrefabs[i].name + clone);
             trashImg[i].SetActive(true);
             countDownText.GetComponent <TextMeshProUGUI>().text = "15";
             CheckTrashImgForActiveTrashIcons(i);
             photonView.RPC("ShowTrash", PhotonTargets.OthersBuffered, i, trashImg[i].activeSelf);
             trashInHand.Add(throwTrashPrefabs[i]);
             trashInHandIndex.Add(i);
             if (photonView.isMine && PhotonNetwork.connected)
             {
                 ItemProperties item = collision.transform.GetComponent <ItemProperties>();
                 item.CheckTrashForRemove();
             }
             //photonView.RPC("DestroyTrash", PhotonTargets.AllBufferedViaServer, collision.transform.name);
             curTimeToDestroyTrashInHand = timeToDestroyTrashInHand;
             countDownText.GetComponent <TextMeshProUGUI>().text = curTimeToDestroyTrashInHand.ToString(curTimeToDestroyTrashInHand < 10? "#":"##");
             isPickup = true;
         }
     }
 }
Exemple #2
0
 private void AddScorePlayer_EatCondition(Collision2D collision, string clone)
 {
     print(transform.name + " Eat : " + collision.transform.name + clone);
     if (photonView.isMine && PhotonNetwork.connected)
     {
         ItemProperties item = collision.transform.GetComponent <ItemProperties>();
         photonPlayer.AddScore(20);
         sfxCreator.Create(addPoint, 0.658f, 1f);
         CreateAddingTwentyScorePrefab();
         item.CheckTrashForRemove();
     }
     //Eat Animation
 }