Esempio n. 1
0
 private void Update()
 {
     if (CutoffFX.phaseStep == 0)
     {
         CutoffFX.currentCutoffVal = 0f;
         this.ChangeFXVal(CutoffFX.currentCutoffVal);
         CutoffFX.phaseStep = 1;
     }
     if (CutoffFX.phaseStep == 1)
     {
         CutoffFX.currentCutoffVal += Time.deltaTime * 7f;
         if (CutoffFX.currentCutoffVal > 1f)
         {
             CutoffFX.currentCutoffVal = 1f;
             CutoffFX.phaseStep        = 2;
         }
         if (CutoffFX.asDetonation != null)
         {
             CutoffFX.asDetonation.volume = 0.5f * Options.gamevol * CutoffFX.currentCutoffVal;
         }
         this.ChangeFXVal(CutoffFX.currentCutoffVal);
     }
     if (CutoffFX.phaseStep == 2)
     {
         CutoffFX.currentCutoffVal -= Time.deltaTime * CutoffFX.incFreq * 0.25f;
         if (CutoffFX.currentCutoffVal < 0f)
         {
             CutoffFX.currentCutoffVal = 0f;
             CutoffFX.phaseStep        = 3;
         }
         if (CutoffFX.asDetonation != null)
         {
             CutoffFX.asDetonation.volume = 0.5f * Options.gamevol * CutoffFX.currentCutoffVal;
         }
         this.ChangeFXVal(CutoffFX.currentCutoffVal);
     }
     if (CutoffFX.phaseStep == 3)
     {
         if (CutoffFX.asDetonation != null)
         {
             CutoffFX.asDetonation.Stop();
         }
         CutoffFX.RemoveFX();
     }
 }
Esempio n. 2
0
    public static void Spawn(float x, float y, float z, float angle)
    {
        GameObject      gameObject      = GameObject.Find("LocalPlayer");
        vp_FPCamera     vp_FPCamera     = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera));
        vp_FPController vp_FPController = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController));

        gameObject.transform.position = new Vector3(x, y, z);
        vp_FPCamera.SetRotation(new Vector2(0f, angle), true, true);
        ChooseTeam.SetActive(false);
        vp_FPCamera.SetMouseFreeze(false);
        vp_FPController.m_CharacterController.enabled = true;
        BasePlayer.health = 100;
        Crosshair.SetActive(true);
        Crosshair.forceLockCursor = true;
        HUD.SetActive(true);
        HUD.cs.OnResize();
        BasePlayer.deadflag = 0;
        if (Client.ID != -1)
        {
            PlayerControll.Player[Client.ID].DeadFlag = 0;
        }
        vp_FPInput.cs.AllowGameplayInput = true;
        BasePlayer.selectedGrenade       = 0;
        vp_FPInput.grenadeThrowStarting  = false;
        vp_FPInput.grenadeThrowEnding    = false;
        vp_FPInput.fastGrenade           = false;
        vp_FPInput.mouseDown             = false;
        vp_FPInput.mouseUp = false;
        if (GameData.restartroundmode != 1 && ScoreBoard.gamemode != 0)
        {
            vp_FPWeapon.RemoveAllMapWeapon();
            vp_FPWeapon.RemoveAllMapSmoke();
        }
        CutoffFX.RemoveFX();
        vp_FPCamera.cs.SetFlashFX(0f, 3.5f);
        BlackScreen.SetActive(false);
        Zombie.SetInfectedScreen(false);
        Zombie.repelVector = Vector2.zero;
        if (Client.ID != -1)
        {
            PlayerControll.Player[Client.ID].bomb = false;
        }
        if (Client.ID != -1)
        {
            PlayerControll.Player[Client.ID].defuse = false;
        }
        ScoreTop.UpdateData();
        if (BasePlayer.weapon[0] == null)
        {
            BasePlayer.weapon[0] = null;
        }
        else
        {
            BasePlayer.weapon[0] = new CWeapon(WeaponData.GetData(BasePlayer.weapon[0].data.wid));
        }
        if (BasePlayer.weapon[1] == null)
        {
            BasePlayer.weapon[1] = new CWeapon(WeaponData.GetData(1));
        }
        else
        {
            BasePlayer.weapon[1] = new CWeapon(WeaponData.GetData(BasePlayer.weapon[1].data.wid));
        }
        if (BasePlayer.weapon[2] == null)
        {
            BasePlayer.weapon[2] = new CWeapon(WeaponData.GetData(28));
        }
        BasePlayer.weapon[3] = null;
        if (BasePlayer.weapon[4] == null)
        {
            BasePlayer.weapon[4] = null;
        }
        BasePlayer.weapon[5] = null;
        BasePlayer.weapon[6] = null;
        if (BasePlayer.weapon[7] == null)
        {
            BasePlayer.weapon[7] = new CWeapon(WeaponData.GetData(31));
        }
        if (BasePlayer.weapon[9] == null)
        {
            BasePlayer.weapon[9] = new CWeapon(WeaponData.GetData(26));
        }
        BasePlayer.currweapon = null;
        BasePlayer.CalcAmmo();
        vp_FPWeaponHandler.cs.m_CurrentWeaponID = 0;
        if (BasePlayer.weapon[0] != null)
        {
            vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[0].data.selectName);
        }
        else if (BasePlayer.weapon[1] != null)
        {
            vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[1].data.selectName);
        }
        else if (BasePlayer.weapon[2] != null)
        {
            vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[2].data.selectName);
        }
        BasePlayer.lastdroppeduid = -1;
        BuyMenu.ShowBuy(x, y, z);
        HitEffect.Reset();
        SpecCam.SetActive(false);
        DeadCam.SetActive(false);
        DeadCam.setspectime = 0f;
        Message.ResetMessage();
        HUD.ResetRespawnBar();
        Award.lastaward = 0;
        global::Console.cs.Command("hud 1");
        HUD.PlayStop();
        Message.SetDead(false);
        PlayerNames.hideradar = false;
        C4.GetPlants();
        C4.isplanting        = false;
        C4.isdiffusing       = false;
        BasePlayer.spawntime = Time.time;
        CC.CheckOnce();
    }