Ejemplo n.º 1
0
    public void SetColors()
    {
        //myGrip.GetComponent<Renderer>().material = colors[myGrip.GetCurPos()];
        //myBarrel.GetComponent<Renderer>().material = colors[myBarrel.GetCurPos()];
        //myAmmo.GetComponent<Renderer>().material = colors[myAmmo.GetCurPos()];
        //Slidertexts();

        if (myGrip.swiMod == null)
        {
            myGrip.swiMod = myGrip.GetComponent <SwitchModel>();
        }
        if (myBarrel.swiMod == null)
        {
            myBarrel.swiMod = myBarrel.GetComponent <SwitchModel>();
        }
        if (myAmmo.swiMod == null)
        {
            myAmmo.swiMod = myAmmo.GetComponent <SwitchModel>();
        }
        myGrip.SetModels();
        myGrip.swiMod.SetModel(myGrip.GetCurPos());
        myBarrel.SetModels();
        myBarrel.swiMod.SetModel(myBarrel.GetCurPos());
        myAmmo.SetModels();
        myAmmo.swiMod.SetModel(myAmmo.GetCurPos());
    }
Ejemplo n.º 2
0
 internal void Fire() //bullet physics, properties, spawn points
 {
     if (ShotCDTimer > ShotSpeed && AmmoCount > 0)
     {
         Barrel.transform.GetChild(0).GetComponent <ParticleSystem>().Play();
         AmmoRegenTimer = 0;
         Vector3    FirePoint3 = Barrel.transform.position + -Barrel.transform.right * 3.5f;
         GameObject Bullet     = (GameObject)Instantiate(BulletPrefab, FirePoint3, Barrel.transform.rotation * Quaternion.Euler(90, 0, 0));
         Physics.IgnoreCollision(Bullet.GetComponent <Collider>(), Barrel.GetComponent <Collider>(), true);
         BulletCharacteristics(Bullet);
         if (TripleShot == true)
         {
             Vector3    FirePoint = Barrel.transform.position + -Barrel.transform.right * 4 - Barrel.transform.forward * 2, FirePoint2 = Barrel.transform.position + -Barrel.transform.right * 4 + Barrel.transform.forward * 2;                                 //pos L&R of normal shooting, world space to local space
             GameObject BulletL = (GameObject)Instantiate(BulletPrefab, FirePoint, Barrel.transform.rotation * Quaternion.Euler(90, 0, 0)), BulletR = (GameObject)Instantiate(BulletPrefab, FirePoint2, Barrel.transform.rotation * Quaternion.Euler(90, 0, 0)); //inst L&R bullets
             BulletCharacteristics(BulletL);
             BulletCharacteristics(BulletR);
         }
         ShotCDTimer = 0;
         AmmoCount  -= 2.5f;
     }
 }