コード例 #1
0
 //gun.start with full clip...
 public void InstantiateMagInPlace()
 {
     if (_curActiveMagInstance == null)
     {
         _curActiveMagInstance = Instantiate(FunctionalMagModel, GunClipLocation.position, GunClipLocation.rotation);
         _curActiveMagInstance.transform.parent = GunClipLocation;
         curMagInGun = _curActiveMagInstance.GetComponent <Mag>();
     }
 }
コード例 #2
0
    //    |
    //    |
    //    |
    //    V
    //ANIMATIONEVENTLISTENER
    //public void OnSlideOutAnimComplete()
    //{
    //    GunPopClipOut();
    //    Debug.Log("yo i heard on slid complete and am not on animatorscript");
    //    //ready to accept a clip
    //    //_myGunBools.BmagIn = false; _myGunBools.BHazBullets = false; _myGunBools.BisReloading = false; //_myGunBools.CanAcceptNewClip = true;
    //}
    public void MAGmngerDropRigidMAg()
    {
        if (_curActiveMagInstance != null)
        {
            GameObject rigidclip = _curActiveMagInstance;
            curMagInGun           = null;
            _curActiveMagInstance = null;

            rigidclip.transform.parent = null;
            DestroyObject(_curActiveMagInstance);
            rigidclip.AddComponent <Rigidbody>();
            rigidclip.GetComponent <Rigidbody>().AddForce(GunClipLocation.forward * -2, ForceMode.Impulse);
            //rigidclip.GetComponent<Mag>().InitCanPlayCollisionSound();
            KillTimer t = rigidclip.AddComponent <KillTimer>();
            t.StartTimer(5.0f);
        }

        //_myGunBools.BmagIn = false;

        ////        _myGunBools.BmagIn = false; _myGunBools.BHazBullets = false; _myGunBools.BisReloading = false;
        //_myGunBools.CanAcceptNewClip = true;
    }