Beispiel #1
0
 public static void LateUpdate()
 {
     if (!DeadCam.show)
     {
         return;
     }
     if (SpecCam.show)
     {
         return;
     }
     if (DeadCam.go == null)
     {
         DeadCam.go          = null;
         DeadCam.show        = false;
         BasePlayer.deadflag = 0;
         if (Client.ID >= 0)
         {
             PlayerControll.Player[Client.ID].DeadFlag = 0;
         }
         return;
     }
     Camera.main.transform.position = DeadCam.go.transform.position;
     Camera.main.transform.rotation = Quaternion.Euler(DeadCam.go.transform.eulerAngles.x, DeadCam.go.transform.eulerAngles.y + 90f, DeadCam.go.transform.eulerAngles.z + 90f);
     PlayerControll.CheckVisible();
     if (DeadCam.setspectime != 0f && Time.time > DeadCam.setspectime)
     {
         DeadCam.setspectime = 0f;
         SpecCam.SetActive(true);
         SpecCam.SetFPCam();
         Message.badge_name = string.Empty;
     }
 }
Beispiel #2
0
    protected override void LateUpdate()
    {
        base.LateUpdate();
        if (Time.timeScale == 0f)
        {
            return;
        }
        this.m_Transform.position       = this.FPController.SmoothPosition;
        this.m_Transform.localPosition += this.m_PositionSpring.State + this.m_PositionSpring2.State;
        Quaternion lhs = Quaternion.AngleAxis(this.m_Yaw + this.m_InitialRotation.x, Vector3.up);
        Quaternion rhs = Quaternion.AngleAxis(0f, Vector3.left);

        base.Parent.rotation = vp_Utility.NaNSafeQuaternion(lhs * rhs, base.Parent.rotation);
        rhs = Quaternion.AngleAxis(-this.m_Pitch - this.m_InitialRotation.y, Vector3.left);
        base.Transform.rotation          = vp_Utility.NaNSafeQuaternion(lhs * rhs, base.Transform.rotation);
        base.Transform.localEulerAngles += vp_Utility.NaNSafeVector3(Vector3.forward * this.m_RotationSpring.State.z, default(Vector3));
        base.Transform.localEulerAngles += vp_Utility.NaNSafeVector3(Vector3.right * this.m_RotationSpring.State.x, default(Vector3));
        base.Transform.localEulerAngles += vp_Utility.NaNSafeVector3(Vector3.up * this.m_RotationSpring.State.y, default(Vector3));
        if (vp_FPCamera.currWeapon != null && vp_FPCamera.currWeapon.m_WeaponCamera001 != null)
        {
            base.Transform.localEulerAngles += vp_FPCamera.currWeapon.m_WeaponCamera001.transform.localEulerAngles - vp_FPCamera.currWeapon.m_WeaponCamera001Zero - vp_FPCamera.r90;
        }
        DeadCam.LateUpdate();
        SpecCam.LateUpdate();
    }
Beispiel #3
0
 public static void LateUpdate()
 {
     if (!SpecCam.show)
     {
         BlackScreen.SetActive(false);
         return;
     }
     if (SpecCam.mode == 0)
     {
         SpecCam.FreeCam();
     }
     else if (SpecCam.mode == 1)
     {
         SpecCam.FPCam();
     }
     if (Input.GetKeyUp(KeyCode.Mouse1) && ScoreBoard.gamemode != 3)
     {
         if (SpecCam.mode == 0)
         {
             SpecCam.SetFPCam();
         }
         else
         {
             SpecCam.mode = 0;
             GameObject gameObject = GameObject.Find("WeaponCamera");
             gameObject.GetComponent <Camera>().cullingMask = 0;
         }
     }
     PlayerControll.CheckVisible();
     if (SpecCam.mode == 1 && SpecCam.FID >= 0)
     {
         PlayerControll.vps[SpecCam.FID] = false;
         PlayerControll.vp[SpecCam.FID]  = false;
     }
 }
Beispiel #4
0
    public static void SetFPCam()
    {
        SpecCam.mode = 1;
        GameObject gameObject = GameObject.Find("WeaponCamera");

        gameObject.GetComponent <Camera>().cullingMask = -2147483648;
        SpecCam.FindPlayer();
        if (SpecCam.FID < 0)
        {
            SpecCam.mode = 0;
            gameObject.GetComponent <Camera>().cullingMask = 0;
        }
    }
Beispiel #5
0
 public static void Update()
 {
     if (SpecCam.mode == 1)
     {
         SpecCam.FPMove();
     }
     if (!SpecCam.show || SpecCam.mode == 1 || Time.realtimeSinceStartup < SpecCam.lastUpdateTime + 0.2f || BasePlayer.team != 255 || ScoreBoard.gamemode != 3)
     {
         return;
     }
     if (SpecCam.mode == 0)
     {
         SpecCam.lastUpdateTime = Time.realtimeSinceStartup;
         SpecCam.SetFPCam();
     }
 }
Beispiel #6
0
    protected override void Update()
    {
        vp_FPController.canStopCrouch = this.CanStop_Crouch();
        base.Update();
        this.SmoothMove();
        float sqrMagnitude = this.Velocity.sqrMagnitude;

        if (Time.time > this.steps_time && this.m_Grounded && !SpecCam.show)
        {
            if (!this.Player.Crouch.Active && !this.Player.Zoom.Active)
            {
                if (sqrMagnitude > 50f)
                {
                    this.steps_audio.volume = 0.6f * Options.gamevol;
                    this.steps_time         = Time.time + 0.31f + UnityEngine.Random.Range(0f, 0.025f);
                    int num = UnityEngine.Random.Range(0, 3);
                    if (num == 0)
                    {
                        num = 3;
                    }
                    this.steps_audio.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
                    if (this.steps_run_gravel[num] != null)
                    {
                        this.steps_audio.PlayOneShot(this.steps_run_gravel[num]);
                    }
                }
                else if (sqrMagnitude > 8f)
                {
                    this.steps_audio.volume = 0.8f * Options.gamevol;
                    this.steps_time         = Time.time + 0.38f + UnityEngine.Random.Range(0f, 0.05f);
                    int num2 = UnityEngine.Random.Range(0, 3);
                    if (num2 == 0)
                    {
                        num2 = 3;
                    }
                    this.steps_audio.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
                    if (this.steps_walk_gravel[num2] != null)
                    {
                        this.steps_audio.PlayOneShot(this.steps_walk_gravel[num2]);
                    }
                }
            }
        }
        Crosshair.SetOffset((int)sqrMagnitude);
        vp_FPInput.speed = sqrMagnitude;
        SpecCam.Update();
    }
Beispiel #7
0
 private static void Choose(int team)
 {
     HUD.PlayStop();
     C4.SendDropBomb();
     if (PlayerPrefs.GetInt("localplay") > 0)
     {
         BasePlayer.team = team;
         BasePlayer.DevSpawn();
     }
     else
     {
         BasePlayer.team = team;
         Client.cs.send_chooseteam(team);
         ChooseTeam.SetActive(false);
         vp_FPWeaponHandler.cs.m_CurrentWeaponID = 0;
         vp_FPInput.cs.Player.SetWeapon.TryStart <int>(0);
         if (ScoreBoard.gamemode == 1 || ScoreBoard.gamemode == 2 || ScoreBoard.gamemode == 3)
         {
             HUD.SetActive(true);
             SpecCam.SetActive(true);
             SpecCam.SetFPCam();
         }
     }
 }
Beispiel #8
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();
    }
Beispiel #9
0
    void Start()
    {
        Esperar  = false;
        TextTime = GameObject.FindGameObjectWithTag("TempoText");


        if (!isLocalPlayer)
        {
            AudioHunt.clip = FootStepsound;
            AudioHunt.loop = true;

            //hunter
            CamHunt.GetComponent <Camera>().enabled        = false;
            CamHunt.GetComponent <AudioListener>().enabled = false;
            CamHunt.tag = "Untagged";
            controllerHunter.enabled = false;

            //prop
            Prop.GetComponent <Move>().enabled             = false;
            CamProp.GetComponent <Camera>().enabled        = false;
            CamProp.GetComponent <AudioListener>().enabled = false;
            CamProp.tag            = "Untagged";
            controllerProp.enabled = false;
            CanvasProp.SetActive(false);
            controllerProp2.enabled = false;


            //spec
            SpecCam.GetComponent <Camera>().enabled        = false;
            SpecCam.GetComponent <AudioListener>().enabled = false;
            SpecCam.tag = "Untagged";
            Spectator.GetComponent <FirstPersonController>().enabled = false;
        }

        else
        { // se for o player
            RemoveGlasses.SetActive(false);
            CanvasPlayersConnected.SetActive(true);
            if (isServer)
            {
                CmdEnviarIshunter(isServer); //true
                CmdEnviarPronto(true);
                Timer = 50;                  // tempo maximo de espera menos 10
            }
            if (!isServer)                   //false
            {
                CmdEnviarIshunter(isServer); //false
            }
            if (isServer)
            {
                Hunt.SetActive(true);
                Hunt.transform.position  = GameObject.FindGameObjectWithTag("Room").transform.position;
                controllerHunter.enabled = true;
            }
            if (!isServer)//false
            {
                Prop.SetActive(true);
                CamPropObj.SetActive(true);
                CamPropObj.GetComponent <FreeLookCam>().SetTarget(Prop.transform);
                controllerProp.enabled = true;
            }
        }
    }
Beispiel #10
0
    private static void FPCam()
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            SpecCam.FindPlayer();
        }
        if (SpecCam.FID >= 0)
        {
            if (PlayerControll.Player[SpecCam.FID] == null)
            {
                SpecCam.FID = -1;
            }
            else if (PlayerControll.Player[SpecCam.FID].go == null)
            {
                SpecCam.FID = -1;
            }
        }
        if (SpecCam.FID < 0)
        {
            SpecCam.FindPlayer();
            if (SpecCam.FID < 0)
            {
                SpecCam.mode = 0;
                GameObject gameObject = GameObject.Find("WeaponCamera");
                gameObject.GetComponent <Camera>().cullingMask = 0;
            }
            return;
        }
        float num = PlayerControll.Player[SpecCam.FID].rotation.x;

        if (num >= 270f && num <= 360f)
        {
            num = 360f - num;
        }
        else if (num >= 0f && num <= 90f)
        {
            num = 0f - num;
        }
        float num2 = SpecCam.rr.x;

        if (num2 >= 270f && num2 <= 360f)
        {
            num2 = 360f - num2;
        }
        else if (num2 >= 0f && num2 <= 90f)
        {
            num2 = 0f - num2;
        }
        float num3 = PlayerControll.Player[SpecCam.FID].rotation.y;
        float num4 = SpecCam.rr.y - PlayerControll.Player[SpecCam.FID].rotation.y;

        if (num4 > 180f)
        {
            num3 += 360f;
        }
        if (num4 < -180f)
        {
            num3 -= 360f;
        }
        SpecCam.rr = Vector3.Lerp(new Vector3(num2, SpecCam.rr.y, SpecCam.rr.z), new Vector3(num, num3, PlayerControll.Player[SpecCam.FID].rotation.z), Time.deltaTime * 5f);
        if (SpecCam.rr.x <= 0f)
        {
            SpecCam.rr.x = SpecCam.rr.x * -1f;
        }
        else
        {
            SpecCam.rr.x = 360f - SpecCam.rr.x;
        }
        Camera.main.transform.eulerAngles = SpecCam.rr;
        Crosshair.SetOffsetNull();
    }