Beispiel #1
0
    public void leftTrigger()
    {
        if (HUDInfo.getAble(XboxAxis.LeftTrigger) && !inputHandler.gameIsEnded)
        {
            Debug.Log("Firing LeftTrigger!");
            int ammoCount = HUDInfo.getAmmo(XboxAxis.LeftTrigger);

            if (ammoCount > 0)
            {
                //Debug.Log("Ammo: " + ammoCount);
                ammoCount = HUDInfo.setAmmo(XboxAxis.LeftTrigger, ammoCount - 1);
                //Debug.Log("setAmmo(): " + ammoCount);
                //Do fire
                keepAbductAlive = true;

                if (HUDInfo.getAmmo(XboxAxis.LeftTrigger) == 0)
                {
                    HUDInfo.callReload(XboxAxis.LeftTrigger);
                }
            }
            else
            {
                Debug.Log("Cannot fire, getAmmo <= 0, is " + HUDInfo.getAmmo(XboxAxis.LeftTrigger));
            }
        }
    }
Beispiel #2
0
    public void fireA()
    {
        Debug.Log("A able: " + HUDInfo.getAble(XboxKey.A) + ", canFireA: " + canFireA);
        if (HUDInfo.getAble(XboxKey.A) && canFireA && !inputHandler.gameIsEnded)
        {
            Debug.Log("Firing A!");
            int ammoCount = HUDInfo.getAmmo(XboxKey.A);
            if (ammoCount > 0)
            {
                GameObject s1 = (GameObject)Instantiate(singleBeam, fireLocation.transform.position, fireLocation.transform.rotation);
                s1.transform.LookAt(rayHit.point);
                s1.GetComponent <BeamParam>().SetBeamParam(ourBeamParam);
                s1.AddComponent <lazerBullet>().setType(1);

                StartCoroutine(fireBeamTwoAndWait(fireLocation2.transform.position, fireLocation2.transform.rotation));

                ammoCount = HUDInfo.setAmmo(XboxKey.A, ammoCount - 2);
                if (HUDInfo.getAmmo(XboxKey.A) == 0)
                {
                    HUDInfo.callReload(XboxKey.A);
                }
                //StartCoroutine(waitA());
            }
            else
            {
                Debug.Log("Cannot fire, getAmmo <= 0");
                HUDInfo.callReload(XboxKey.A);
            }
        }
    }
Beispiel #3
0
    public void fireB()
    {
        if (HUDInfo.getAble(XboxKey.B) && canFireB && !inputHandler.gameIsEnded)
        {
            Debug.Log("Firing B!");
            int ammoCount = HUDInfo.getAmmo(XboxKey.B);

            if (ammoCount > 0)
            {
                ammoCount          = HUDInfo.setAmmo(XboxKey.B, ammoCount - 1);
                keepConstBeamAlive = true;
                if (beam != null)
                {
                    beam.transform.position = fireLocation.transform.position;
                }

                if (ammoCount <= 0)
                {
                    Debug.Log("Reloading!");
                    HUDInfo.callReload(XboxKey.B);
                }
            }
            HUDInfo.callReload(XboxKey.B);
        }
    }
Beispiel #4
0
    public void rightTrigger()
    {
        if (HUDInfo.getAble(XboxAxis.RightTrigger) && canFireRight && !inputHandler.gameIsEnded)
        {
            Debug.Log("Firing Right Trigger!");
            int ammoCount = HUDInfo.getAmmo(XboxAxis.RightTrigger);

            if (ammoCount > 0)
            {
                //Debug.Log("Ammo: " + ammoCount);
                ammoCount = HUDInfo.setAmmo(XboxAxis.RightTrigger, ammoCount - 1);
                //Debug.Log("setAmmo(): " + ammoCount);
                //Do fire

                /*GameObject instantiated = (GameObject)Instantiate(bullet, fireLocation.transform.position, Quaternion.identity);
                 * Rigidbody instantiatedRigid = instantiated.GetComponent<Rigidbody>();
                 * //THANKS TO WEI
                 * instantiatedRigid.AddForce((rayHit.point- instantiated.transform.position).normalized * (float)instantiated.GetComponent<bullet>().getFireForce());*/
                GameObject s1 = (GameObject)Instantiate(singleBeam, fireLocation.transform.position, fireLocation.transform.rotation);
                s1.transform.LookAt(rayHit.point);
                s1.GetComponent <BeamParam>().SetBeamParam(ourBeamParam);
                s1.AddComponent <lazerBullet>().setType(0);
                lazerFireSource.Play();


                //instantiatedRigid.AddForceAtPosition(rayHit.point * instantiated.GetComponent<bullet>().getFireForce(), transform.forward);
                // PrintingIsDumb =

                //wait Fire
                StartCoroutine(waitRight());

                if (HUDInfo.getAmmo(XboxAxis.RightTrigger) <= 0 || ammoCount <= 0)
                {
                    Debug.Log("calling reload");
                    HUDInfo.callReload(XboxAxis.RightTrigger);
                }
            }
            else
            {
                Debug.Log("Cannot fire, getAmmo <= 0, is " + ammoCount);
                HUDInfo.callReload(XboxAxis.RightTrigger);
            }
        }
    }
Beispiel #5
0
 public void fireY()
 {
     if (HUDInfo.getAble(XboxKey.Y))
     {
         Debug.Log("Firing Y!");
         int ammoCount = HUDInfo.getAmmo(XboxKey.Y);
         if (ammoCount > 0)
         {
             Debug.Log("Ammo: " + ammoCount);
             ammoCount = ammoCount - 1;
             Debug.Log("setAmmo(): " + HUDInfo.setAmmo(XboxKey.Y, ammoCount));
             if (HUDInfo.getAmmo(XboxKey.Y) == 0)
             {
                 HUDInfo.callReload(XboxKey.Y);
             }
         }
         else
         {
             Debug.Log("Cannot fire, getAmmo <= 0");
         }
     }
 }