예제 #1
0
 void Start()
 {
     itemimage    = this.GetComponent <Image>();
     buttoncom    = this.GetComponent <Button>();
     playerscript = Player.GetComponent <OnlinePlayerScript>();
     if (setnumber == 1)
     {
         itemset = PlayerPrefs.GetInt("ItemSet1");
     }
     if (setnumber == 2)
     {
         itemset = PlayerPrefs.GetInt("ItemSet2");
     }
     if (setnumber == 3)
     {
         itemset = PlayerPrefs.GetInt("ItemSet3");
     }
     if (itemset == 0)
     {
         itemimage.sprite = itemempty;
     }
     if (itemset == 1)
     {
         itemimage.sprite = item1;
     }
     if (itemset == 2)
     {
         itemimage.sprite = item2;
     }
     if (itemset == 3)
     {
         itemimage.sprite = item3;
     }
     if (itemset == 4)
     {
         itemimage.sprite = item4;
     }
     if (itemset == 5)
     {
         itemimage.sprite = item5;
     }
     if (itemset == 6)
     {
         itemimage.sprite = item6;
     }
     if (itemset == 7)
     {
         itemimage.sprite = item7;
     }
     if (itemset == 8)
     {
         itemimage.sprite = item8;
     }
     if (itemset == 7 || itemset == 8)
     {
         buttoncom.enabled = true;
         itemplay.gameObject.SetActive(true);
     }
 }
예제 #2
0
 void OnCollisionEnter(Collision collision)
 {
     if (this.photonView.isMine)
     {
         if (collision.gameObject.tag == "Field")
         {
             if (refcount < reflimit)
             {
                 ContactPoint point  = collision.contacts[0];
                 Vector3      normal = point.normal;
                 direction += 2 * Vector3.Dot(-direction, normal) * normal;
                 refcount++;
             }
             else
             {
                 PhotonNetwork.Destroy(this.gameObject);
             }
         }
         if (collision.gameObject.tag == "Enemy")
         {
             GameObject.Find("MyManager").GetComponent <MyManagerScript>().myscore += 10;
             Instantiate(shotsound);
             bullife--;
             if (bullife <= 0)
             {
                 PhotonNetwork.Destroy(this.gameObject);
             }
         }
         if (collision.gameObject.tag == "Block")
         {
             Destroy(this.gameObject);
         }
         if (collision.gameObject.tag == "Player")
         {
             if (!collision.gameObject.GetComponent <PhotonView>().isMine)
             {
                 OPS = collision.gameObject.GetComponent <OnlinePlayerScript>();
                 if (!OPS.muteki)
                 {
                     if (OPS.playerhp <= bulletpower)
                     {
                         GameObject.Find("MyManager").GetComponent <MyManagerScript>().myscore += 100;
                     }
                     Instantiate(shotsound);
                 }
                 bullife--;
                 if (bullife <= 0)
                 {
                     PhotonNetwork.Destroy(this.gameObject);
                 }
             }
         }
     }
 }