Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (pls.weaponFirst != null)
     {
         ammoin    = weap.ammoAR;
         text.text = ammoin.ammo.ToString() + "/" + pls.AmmoAr15.ToString();
     }
 }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         if (pls.weaponFirst == null)
         {
             if (Rar15.IsMatch(pls.col.name) == true)
             {
                 col = pls.col;
                 m_SpriteRenderer = col.gameObject.GetComponent <SpriteRenderer>();
                 Rigidbody2D rb = col.gameObject.GetComponent <Rigidbody2D>();
                 ammoAR          = col.gameObject.GetComponent <AmmoAR15>();
                 rb.simulated    = false;
                 pls.weaponFirst = ar15;
                 //Destroy(pls.col.gameObject);
                 m_SpriteRenderer.enabled = false;
                 col.transform.SetParent(firePoint.GetComponent <Transform>());
                 pls.animator.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("GGar15");
             }
             //pls.col.transform.SetParent(pls.plr);
         }
     }
     if (Input.GetKeyDown(KeyCode.G))
     {
         if (pls.weaponFirst != null)
         {
             pls.animator.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("GGrun");
             //GameObject weapon = Instantiate(pls.weaponFirst.gameObject, firePoint.position, firePoint.rotation);
             Rigidbody2D rb = col.gameObject.GetComponent <Rigidbody2D>();
             col.transform.SetParent(null);
             rb.AddForce(firePoint.up * 15, ForceMode2D.Impulse);
             m_SpriteRenderer.enabled = true;
             rb.simulated             = true;
             pls.weaponFirst          = null;
         }
     }
     if (pls.weaponFirst == ar15)
     {
         if (ammoAR.ammo < 30)
         {
             if (pls.AmmoAr15 != 0)
             {
                 if (Input.GetKeyDown(KeyCode.R))
                 {
                     ReloadAR();
                 }
             }
         }
     }
 }