Ejemplo n.º 1
0
 public void Shot()
 {
     if (shotCount < shotMaxCount)
     {
         if (isNormal)
         {
             GameObject shell = shellManagerSc.GetShell();
             shell.transform.rotation = Quaternion.Euler(0, head.transform.rotation.eulerAngles.y + 90, 90);
             shell.transform.position = shotPos.transform.position;
             Rigidbody shellRb = shell.GetComponent <Rigidbody>();
             shellRb.AddForce(head.transform.forward * shotSpeed);
             AudioSource.PlayClipAtPoint(shotSound, transform.position);
             shotCount     += 1;
             shellText.text = (shotMaxCount - shotCount).ToString();
         }
         if (isDiffuse)
         {
             for (int i = 0; i < 3; i++)
             {
                 GameObject shellClone = Instantiate(diffuseShell, shotPos.transform.position, Quaternion.Euler(0, head.transform.rotation.eulerAngles.y + 80 + 10 * i, 90));
                 Rigidbody  rb         = shellClone.GetComponent <Rigidbody>();
                 rb.AddForce(shellClone.transform.up * shotSpeed * 0.8f);
             }
             AudioSource.PlayClipAtPoint(shotSound, transform.position);
             shotCount     += 1;
             shellText.text = (shotMaxCount - shotCount).ToString();
         }
         if (isPenetration)
         {
             GameObject shellClone = Instantiate(penetrationShell, shotPos.transform.position, Quaternion.Euler(0, head.transform.rotation.eulerAngles.y + 90, 90));
             Rigidbody  rb         = shellClone.GetComponent <Rigidbody>();
             rb.AddForce(head.transform.forward * shotSpeed * 1.2f);
             AudioSource.PlayClipAtPoint(shotSound, transform.position);
             shotCount     += 1;
             shellText.text = (shotMaxCount - shotCount).ToString();
         }
         if (isBounce)
         {
             GameObject shellClone = Instantiate(bounceShell, shotPos.transform.position, Quaternion.Euler(0, head.transform.rotation.eulerAngles.y + 90, 90));
             Rigidbody  rb         = shellClone.GetComponent <Rigidbody>();
             rb.AddForce(head.transform.forward * shotSpeed);
             AudioSource.PlayClipAtPoint(shotSound, transform.position);
             shotCount     += 1;
             shellText.text = (shotMaxCount - shotCount).ToString();
         }
     }
 }
Ejemplo n.º 2
0
        private void ShowHide(string shellname, ref bool isShow)
        {
            IShell shell = ShellManager.GetShell(shellname);

            if (shell != null)
            {
                if (!isShow)
                {
                    shell.ShowShell();
                }
                else
                {
                    shell.HideShell();
                }

                isShow = !isShow;
            }
        }