Пример #1
0
    public static void CreateWeapon(int wid, int bwid)
    {
        GameObject gameObject = ContentLoader_.LoadGameObject("p_" + MenuShop.shopdata[wid].name2);

        if (gameObject != null)
        {
            GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity) as GameObject;
            GameObject gameObject3 = GameObject.Find(MenuPlayer.goPlayer.name + "/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand");
            gameObject2.transform.parent        = gameObject3.transform;
            gameObject2.transform.localPosition = gameObject.transform.localPosition;
            gameObject2.transform.localRotation = gameObject.transform.localRotation;
            if (MenuShop.currData != null && MenuShop.currData.section == 5 && wid >= 1 && wid <= 25)
            {
                Component[] componentsInChildren = gameObject2.GetComponentsInChildren(typeof(Renderer));
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    Renderer renderer = (Renderer)componentsInChildren[i];
                    renderer.materials[0].SetTexture(0, TEX.GetTextureByName(MenuShop.currData.iconname));
                }
            }
        }
        GameObject gameObject4 = ContentLoader_.LoadGameObject("b_" + MenuShop.shopdata[bwid].name2);

        if (gameObject != null)
        {
            GameObject gameObject5 = UnityEngine.Object.Instantiate(gameObject4, Vector3.zero, Quaternion.identity) as GameObject;
            GameObject gameObject6 = GameObject.Find(MenuPlayer.goPlayer.name + "/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1");
            gameObject5.transform.parent        = gameObject6.transform;
            gameObject5.transform.localPosition = gameObject4.transform.localPosition;
            gameObject5.transform.localRotation = gameObject4.transform.localRotation;
        }
    }
Пример #2
0
    public static GameObject Create(string name)
    {
        GameObject gameObject = ContentLoader_.LoadGameObject(name);

        if (gameObject == null)
        {
            MonoBehaviour.print("not founded " + name);
            return(null);
        }
        return(UnityEngine.Object.Instantiate(gameObject, gameObject.transform.position, gameObject.transform.rotation) as GameObject);
    }
Пример #3
0
 private void Update()
 {
     if (this.handletime != 0f && Time.time > this.handletime)
     {
         this.handle = GameObject.Find(base.gameObject.name + "/handle");
         this.handle.transform.SetParent(null);
         this.handle.GetComponent <Rigidbody>().isKinematic = false;
         this.handle.GetComponent <Rigidbody>().AddForce(base.gameObject.GetComponent <Rigidbody>().velocity + Camera.main.transform.right * 75f);
         this.handle.GetComponent <Rigidbody>().AddTorque(this.handle.transform.forward * 500f);
         this.handletime = 0f;
     }
     if (this.explodetime != 0f && Time.time > this.explodetime)
     {
         GameObject original = ContentLoader_.LoadGameObject("Detonator");
         UnityEngine.Object.Instantiate(original, base.gameObject.transform.position + Vector3.up * 0.1f, base.gameObject.transform.rotation);
         this.explodetime = 0f;
         if (this.handle)
         {
             UnityEngine.Object.Destroy(this.handle);
         }
         UnityEngine.Object.Destroy(base.gameObject);
         if (base.gameObject.GetComponent <BaseEnt>().ownerid == Client.ID)
         {
             Client.cs.send_ent_destroy(this.uid, base.gameObject.GetComponent <BaseEnt>().type, base.gameObject.transform.position);
         }
         if (vp_FPController.cs == null || vp_FPCamera.cs == null)
         {
             return;
         }
         float num = Vector3.Distance(vp_FPController.cs.SmoothPosition, base.gameObject.transform.position);
         if (num > 20f)
         {
             return;
         }
         float num2 = 0.001f;
         if (num < 5f)
         {
             num2 = 0.005f;
         }
         else if (num < 10f)
         {
             num2 = 0.003f;
         }
         num = 20f - num;
         vp_FPCamera.cs.AddForce2(new Vector3(2f, -10f, 2f) * num * num2);
         if (UnityEngine.Random.value > 0.5f)
         {
             num2 = -num2;
         }
         vp_FPCamera.cs.AddRollForce(num2 * 200f);
     }
 }
Пример #4
0
 public void PostAwake()
 {
     C4.checkTime       = Time.realtimeSinceStartup;
     C4.trPlayer        = GameObject.Find("LocalPlayer").transform;
     C4.placeBomb       = ContentLoader_.LoadGameObject("c4_place");
     C4.plantStartSound = SND.GetSoundByName("c4_plant");
     C4.showDiffuseBar  = false;
     C4.sector          = new C4.PlantSector[2];
     C4.plant           = new List <C4.PlantSector> [2];
     C4.plant[0]        = new List <C4.PlantSector>();
     C4.plant[1]        = new List <C4.PlantSector>();
     this.csCamera      = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera));
     this.csController  = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController));
 }
Пример #5
0
 private void LoadEnd()
 {
     MenuPlayer.pgoPlayer = ContentLoader_.LoadGameObject("pwmplayer");
     if (MenuPlayer.pgoPlayer == null)
     {
         MonoBehaviour.print("MenuPlayer::pgoPlayer null");
     }
     if (!BaseData.Auth)
     {
         return;
     }
     Main.HideAll();
     MenuPlayer.SetActive(true);
 }
Пример #6
0
 public static void Init()
 {
     EntControll.pgoEntFG = ContentLoader_.LoadGameObject("ent_fg");
     EntControll.pgoEntFB = ContentLoader_.LoadGameObject("ent_fb");
     EntControll.pgoEntSG = ContentLoader_.LoadGameObject("ent_sg");
 }
Пример #7
0
    public static void Explosion()
    {
        C4Place.isActive = false;
        if (C4Place.asBeep == null)
        {
            return;
        }
        float num;

        if (SpecCam.show)
        {
            if (SpecCam.FID >= 0 && SpecCam.mode == 1 && PlayerControll.Player[SpecCam.FID] != null)
            {
                num = Vector3.Distance(C4.bombGo.transform.position, PlayerControll.Player[SpecCam.FID].go.transform.position);
            }
            else
            {
                num = Vector3.Distance(C4.bombGo.transform.position, SpecCam.position);
            }
        }
        else
        {
            num = Vector3.Distance(C4.bombGo.transform.position, BasePlayer.go.transform.position);
        }
        if (num < 50f)
        {
            C4Place.asBeep.volume      = 0.5f * Options.gamevol;
            C4Place.asBeep.maxDistance = 55f;
            C4Place.asBeep.PlayOneShot(C4Place.detonationSound);
        }
        else
        {
            C4Place.asBeep.volume      = 1f * Options.gamevol;
            C4Place.asBeep.maxDistance = 999999f;
            C4Place.asBeep.PlayOneShot(C4Place.detonationFarSound);
        }
        GameObject original = ContentLoader_.LoadGameObject("Detonator");

        UnityEngine.Object.Instantiate(original, C4.bombGo.transform.position + Vector3.up * 0.1f, C4.bombGo.transform.rotation);
        if (vp_FPController.cs == null || vp_FPCamera.cs == null)
        {
            return;
        }
        float num2 = Vector3.Distance(vp_FPController.cs.SmoothPosition, C4.bombGo.transform.position);

        if (num2 > 30f)
        {
            return;
        }
        float num3 = 0.001f;

        if (num2 < 5f)
        {
            num3 = 0.005f;
        }
        else if (num2 < 10f)
        {
            num3 = 0.003f;
        }
        num2 = 30f - num2;
        vp_FPCamera.cs.AddForce2(new Vector3(2f, -10f, 2f) * num2 * num3);
        if (UnityEngine.Random.value > 0.5f)
        {
            num3 = -num3;
        }
        vp_FPCamera.cs.AddRollForce(num3 * 200f);
        C4.DestroyBomb();
    }