/// <summary>
	/// 
	/// </summary>
	protected virtual void Start()
	{
		
		// store a reference to the FPSWeapon
		m_Weapon = transform.GetComponent<vp_FPWeapon>();
		
	}
Exemple #2
0
 //On awake sets the values of the variables to point to the right objects.
 protected virtual void Awake()
 {
     Player = GameObject.FindObjectOfType(typeof(vp_FPPlayerEventHandler)) as vp_FPPlayerEventHandler;
     cross = GameObject.FindObjectOfType(typeof(vp_SimpleCrosshair)) as vp_SimpleCrosshair;
     Gun = GameObject.FindObjectOfType(typeof(vp_FPWeapon)) as vp_FPWeapon;
     camera = GameObject.FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera;
     myCam=camera.GetComponent<Camera>();
     BaseFOV=camera.RenderingFieldOfView;//Replaces the value of BaseFOV to whatever the actual Base FOV is.
     BaseShake=camera.ShakeSpeed;//Does the same to the base shake value.
 }
Exemple #3
0
	/// <summary>
	/// hooks up the FPSCamera object to the inspector target
	/// </summary>
	public void OnEnable()
	{

		m_Component = (vp_FPWeapon)target;

		if (m_Persister == null)
			m_Persister = new vp_ComponentPersister();
		m_Persister.Component = m_Component;
		m_Persister.IsActive = true;

		if (m_Component.DefaultState == null)
			m_Component.RefreshDefaultState();
		
	}
    /// <summary>
    ///
    /// </summary>
    public void DeactivateAll(List <vp_Weapon> weaponList)
    {
        foreach (vp_Weapon weapon in weaponList)
        {
            weapon.ActivateGameObject(false);
            vp_FPWeapon fpWeapon = weapon as vp_FPWeapon;
            if ((fpWeapon != null) && (fpWeapon.Weapon3rdPersonModel != null))
            {
                vp_Utility.Activate(fpWeapon.Weapon3rdPersonModel, false);
            }
        }

        m_CurrentShooter = null;
    }
    /// <summary>
    /// restores all the settings on the weapon and shooter from the backup
    /// made by 'BackupWeaponSettings'. this is to allow for toggling the VR
    /// feature set on and off at runtime
    /// </summary>
    protected virtual void RestoreWeaponSettings(vp_Shooter shooter)
    {
        if (shooter == null)
        {
            return;
        }

        // restore weapon lookdown status
        vp_FPWeapon fpWeapon = shooter.GetComponent <vp_FPWeapon>();

        if (fpWeapon != null)
        {
            bool lookDown;
            if (m_LookDownBackups.TryGetValue(fpWeapon, out lookDown))
            {
                fpWeapon.LookDownActive = lookDown;
            }
            float retraction;
            if (m_RetractionBackups.TryGetValue(fpWeapon, out retraction))
            {
                fpWeapon.RetractionDistance = retraction;
            }
        }

        // restore shooter fire position
        vp_Shooter.FirePositionFunc pf;
        if (m_FirePositionFuncBackups.TryGetValue(shooter, out pf))
        {
            shooter.GetFirePosition = pf;
        }
        vp_Shooter.FireRotationFunc rf;
        if (m_FireRotationFuncBackups.TryGetValue(shooter, out rf))
        {
            shooter.GetFireRotation = rf;
        }

        // restore shooter camera recoils
        if (shooter is vp_FPWeaponShooter)
        {
            vp_FPWeaponShooter ws = (shooter as vp_FPWeaponShooter);
            Vector2            recoils;
            if (m_ShooterCameraRecoilBackups.TryGetValue(ws, out recoils))
            {
                ws.MotionPositionRecoilCameraFactor = recoils.x;
                ws.MotionRotationRecoilCameraFactor = recoils.y;
            }
        }
    }
    /// <summary>
    /// hooks up the FPSCamera object to the inspector target
    /// </summary>
    public void OnEnable()
    {
        m_Component = (vp_FPWeapon)target;

        if (m_Persister == null)
        {
            m_Persister = new vp_ComponentPersister();
        }
        m_Persister.Component = m_Component;
        m_Persister.IsActive  = true;

        if (m_Component.DefaultState == null)
        {
            m_Component.RefreshDefaultState();
        }
    }
Exemple #7
0
        static void Postfix(vp_FPWeapon __instance)
        {
            // I don't actually use these values because the game overrides them for non-gun items. RenderingFieldOfView is set to 45 from scripts inside resources.assets such as WeaponBow, WeaponDefault ...
            CustomPrefs customPrefs = CustomPrefs.GetCustomPrefs();

            try
            {
                __instance.RenderingFieldOfView         = customPrefs.GetCustomPref <int>("WeaponFov");
                __instance.originalRenderingFieldOfView = customPrefs.GetCustomPref <int>("WeaponFov");
            }
            catch (ArgumentException e)
            {
                customPrefs.SetCustomPref <int>("WeaponFov", 60);
                __instance.RenderingFieldOfView         = customPrefs.GetCustomPref <int>("WeaponFov");
                __instance.originalRenderingFieldOfView = customPrefs.GetCustomPref <int>("WeaponFov");
            }
        }
Exemple #8
0
        public override void Initialize()
        {
            tr = transform;

            base.Initialize();

            Player.Get.UserActions.Subscribe(UserActionType.ToolUse, new ActionListener(ToolUse));
            Player.Get.UserActions.Subscribe(UserActionType.ToolUseHold, new ActionListener(ToolUseHold));
            Player.Get.UserActions.Subscribe(UserActionType.ToolUseRelease, new ActionListener(ToolUseRelease));
            Player.Get.UserActions.Subscribe(UserActionType.ActionCancel, new ActionListener(ActionCancel));
            Player.Get.UserActions.Subscribe(UserActionType.ToolCycleNext, new ActionListener(ToolCycleNext));
            Player.Get.UserActions.Subscribe(UserActionType.ToolCyclePrev, new ActionListener(ToolCyclePrev));

            Player.Get.AvatarActions.Subscribe(AvatarAction.ItemAQIChange, new ActionListener(ItemAQIChange));
            Player.Get.AvatarActions.Subscribe(AvatarAction.ControlRestore, new ActionListener(ControlRestore));

            FPSWeapon = player.FPSWeapon;
        }
Exemple #9
0
        static bool Prefix(vp_FPWeapon __instance, float ___m_FinalZoomTime, bool ___m_Wielded, GameObject ___m_WeaponCamera)
        {
            if (!___m_Wielded)
            {
                return(false);
            }

            __instance.RenderingZoomDamping = Mathf.Max(__instance.RenderingZoomDamping, 0.01f);
            float num = 1f - (___m_FinalZoomTime - Time.time) / __instance.RenderingZoomDamping;

            if (___m_WeaponCamera != null)
            {
                CustomPrefs customPrefs = CustomPrefs.GetCustomPrefs();
                ___m_WeaponCamera.GetComponent <Camera>().fieldOfView = Mathf.SmoothStep(___m_WeaponCamera.gameObject.GetComponent <Camera>().fieldOfView, customPrefs.GetCustomPref <int>("WeaponFov"), num * 15f);
            }

            return(false);
        }
Exemple #10
0
    /// <summary>
    ///
    /// </summary>
    protected override void Start()
    {
        base.Start();

        // defaults for using animation length as the fire and reload delay
        if (ProjectileFiringRate == 0.0f && AnimationFire != null)
        {
            ProjectileFiringRate = AnimationFire.length;
        }

        // store a reference to the FPSWeapon
        m_FPSWeapon = transform.GetComponent <vp_FPWeapon>();

        // defaults for using animation length as the fire delay
        if (ProjectileFiringRate == 0.0f && AnimationFire != null)
        {
            ProjectileFiringRate = AnimationFire.length;
        }
    }
Exemple #11
0
    /// <summary>
    /// this method will disable the currently activated weapon
    /// and activate the one with 'weaponIndex'. if index is zero,
    /// no weapon will be activated. NOTE: this method will make
    /// any old weapon instantly pop away and make the new one
    /// pop into view. for smooth transitions, please instead
    /// use the vp_FPPlayerEventHandler 'SetWeapon' event.
    /// example: m_Player.SetWeapon.TryStart(3);
    /// </summary>
    public virtual void SetWeapon(int weaponIndex)
    {
        if (m_Weapons.Count < 1)
        {
            Debug.LogError("Error: (" + this + ") Tried to set weapon with an empty weapon list.");
            return;
        }

        if (weaponIndex < 0 || weaponIndex > m_Weapons.Count)
        {
            Debug.LogError("Error: (" + this + ") Weapon list does not have a weapon with index: " + weaponIndex);
            return;
        }

        // before putting old weapon away, make sure it's in a neutral
        // state next time it is activated
        if (m_CurrentWeapon != null)
        {
            m_CurrentWeapon.ResetState();
        }

        // deactivate all weapons
        foreach (vp_FPWeapon weapon in m_Weapons)
        {
            weapon.ActivateGameObject(false);
        }

        // activate new weapon
        m_CurrentWeaponIndex = weaponIndex;
        m_CurrentWeapon      = null;
        if (m_CurrentWeaponIndex > 0)
        {
            m_CurrentWeapon = m_Weapons[m_CurrentWeaponIndex - 1];
            if (m_CurrentWeapon != null)
            {
                m_CurrentWeapon.ActivateGameObject(true);
            }
        }
    }
Exemple #12
0
 public virtual void SetWeapon(int i)
 {
     if (this.m_Weapons.Count < 1)
     {
         Debug.LogError("Error: (" + this + ") Tried to set weapon with an empty weapon list.");
         return;
     }
     if (i < 0 || i > this.m_Weapons.Count)
     {
         Debug.LogError(string.Concat(new object[]
         {
             "Error: (",
             this,
             ") Weapon list does not have a weapon with index: ",
             i
         }));
         return;
     }
     if (this.m_CurrentWeapon != null)
     {
         this.m_CurrentWeapon.ResetState();
     }
     foreach (vp_FPWeapon current in this.m_Weapons)
     {
         current.ActivateGameObject(false);
     }
     this.m_CurrentWeaponID = i;
     this.m_CurrentWeapon   = null;
     if (this.m_CurrentWeaponID > 0)
     {
         this.m_CurrentWeapon = this.m_Weapons[this.m_CurrentWeaponID - 1];
         if (this.m_CurrentWeapon != null)
         {
             this.m_CurrentWeapon.ActivateGameObject(true);
         }
     }
 }
Exemple #13
0
 protected override void Start()
 {
     base.Start();
     this.m_FPSWeapon = base.transform.GetComponent <vp_FPWeapon>();
 }
    /// <summary>
    /// makes a backup of all the settings on the weapon and shooter that this
    /// component manipulates, for later restoration in 'RestoreWeaponSettings'
    /// </summary>
    protected virtual void BackupWeaponSettings()
    {
        if (WeaponHandler == null)
        {
            return;
        }

        foreach (vp_Weapon weapon in WeaponHandler.Weapons)
        {
            if (weapon == null)
            {
                continue;
            }

            // backup weapon lookdown status
            if (weapon is vp_FPWeapon)
            {
                vp_FPWeapon fpWeapon = (weapon as vp_FPWeapon);
                if (!m_LookDownBackups.ContainsKey(fpWeapon))
                {
                    m_LookDownBackups.Add(fpWeapon, fpWeapon.LookDownActive);
                }
                if (!m_RetractionBackups.ContainsKey(fpWeapon))
                {
                    m_RetractionBackups.Add(fpWeapon, fpWeapon.RetractionDistance);
                }
            }

            // backup shooter fire position
#if UNITY_5_3_OR_NEWER
            vp_Shooter shooter = weapon.GetComponentInChildren <vp_Shooter>(true);              // IMPORTANT: this works in Unity 5.3.4f1, but is not guaranteed to work in earlier versions
#else
            vp_Shooter shooter = weapon.GetComponentInChildren <vp_Shooter>();
#endif
            if (shooter == null)
            {
                continue;
            }
            if ((!(shooter.GetFirePosition == null)) && (!m_FirePositionFuncBackups.ContainsKey(shooter)))
            {
                m_FirePositionFuncBackups.Add(shooter, shooter.GetFirePosition);
            }
            if ((!(shooter.GetFireRotation == null)) && (!m_FireRotationFuncBackups.ContainsKey(shooter)))
            {
                m_FireRotationFuncBackups.Add(shooter, shooter.GetFireRotation);
            }

            // backup
            if (shooter is vp_FPWeaponShooter)
            {
                vp_FPWeaponShooter ws = (shooter as vp_FPWeaponShooter);
                if (!m_ShooterCameraRecoilBackups.ContainsKey(ws))
                {
                    m_ShooterCameraRecoilBackups.Add(ws, new Vector2(ws.MotionPositionRecoilCameraFactor, ws.MotionRotationRecoilCameraFactor));
                }
            }

            Renderer r = weapon.GetComponentInChildren <Renderer>();
            if (r != null)
            {
                r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            }
        }
    }
    /// <summary>
    /// this method will first disable the currently activated
    /// weapon, then activate the one with index 'i'. if 'i' is
    /// zero, no child will be activated. if 'snap' is true,
    /// the weapon will appear instantly in view (instead of
    /// transitioning from its exit offset)
    /// </summary>
    public virtual void SetWeapon(int i)
    {
        if (m_Weapons.Count < 1)
        {
            Debug.LogError("Error: (" + this + ") Tried to set weapon with an empty weapon list.");
            return;
        }

        if (i < 0 || i > m_Weapons.Count)
        {
            Debug.LogError("Error: (" + this + ") Weapon list does not have a weapon with index: " + i);
            return;
        }

        // before putting old weapon away, make sure it's in a neutral
        // state next time it is activated
        if (m_CurrentWeapon != null)
            m_CurrentWeapon.ResetState();

        // deactivate all weapons
        foreach (vp_FPWeapon weapon in m_Weapons)
        {
            weapon.ActivateGameObject(false);
        }

        // activate new weapon
        m_CurrentWeaponID = i;
        m_CurrentWeapon = null;
        if (m_CurrentWeaponID > 0)
        {
            m_CurrentWeapon = m_Weapons[m_CurrentWeaponID - 1];
            if (m_CurrentWeapon != null)
                m_CurrentWeapon.ActivateGameObject(true);
        }
    }
Exemple #16
0
 protected virtual void Start()
 {
     this.m_Weapon = base.transform.GetComponent <vp_FPWeapon>();
 }
Exemple #17
0
    private void ParsingCommand(string cmd)
    {
        this.AddLogString(cmd);
        this.inputstore = cmd;
        string[] array = cmd.Split(new char[]
        {
            ' '
        });
        if (array[0] == "map")
        {
            if (array.Length != 2)
            {
                return;
            }
            MapLoader mapLoader = (MapLoader)UnityEngine.Object.FindObjectOfType(typeof(MapLoader));
            PlayerPrefs.SetInt("localplay", 1);
            mapLoader.Load(array[1]);
        }
        else if (array[0] == "devmap")
        {
            if (array.Length != 2)
            {
                return;
            }
            MapLoader mapLoader2 = (MapLoader)UnityEngine.Object.FindObjectOfType(typeof(MapLoader));
            PlayerPrefs.SetInt("localplay", 2);
            mapLoader2.DevLoad(array[1]);
        }
        else if (array[0] == "team")
        {
            if (array.Length != 3)
            {
                return;
            }
            int num  = 0;
            int num2 = 0;
            if (!int.TryParse(array[1], out num))
            {
                return;
            }
            if (!int.TryParse(array[2], out num2))
            {
                return;
            }
            if (num < 0 || num >= 2)
            {
                return;
            }
            if (num2 < 0 || num2 >= 8)
            {
                return;
            }
            UnityEngine.Object[] array2 = UnityEngine.Object.FindObjectsOfType(typeof(Spawn));
            List <Spawn>         list   = new List <Spawn>();
            List <Spawn>         list2  = new List <Spawn>();
            UnityEngine.Object[] array3 = array2;
            for (int i = 0; i < array3.Length; i++)
            {
                Spawn spawn = (Spawn)array3[i];
                if (spawn.Team == 0)
                {
                    list.Add(spawn);
                }
                else if (spawn.Team == 1)
                {
                    list2.Add(spawn);
                }
            }
            GameObject gameObject = null;
            if (num == 0)
            {
                if (num2 >= list.Count)
                {
                    return;
                }
                gameObject = list[num2].gameObject;
            }
            else if (num == 1)
            {
                if (num2 >= list2.Count)
                {
                    return;
                }
                gameObject = list2[num2].gameObject;
            }
            MonoBehaviour.print("spawn");
            GameObject  gameObject2 = GameObject.Find("LocalPlayer");
            vp_FPCamera vp_FPCamera = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera));
            gameObject2.transform.position = gameObject.transform.position;
            vp_FPCamera.SetRotation(new Vector2(0f, gameObject.transform.eulerAngles.y), true, true);
        }
        else if (array[0] == "sky")
        {
            if (array.Length != 2)
            {
                return;
            }
        }
        else if (array[0] == "sun_shadowbias" || array[0] == "sun_shadows")
        {
            if (array.Length != 2)
            {
                return;
            }
            UnityEngine.Object[] array4 = UnityEngine.Object.FindObjectsOfType(typeof(Light));
            Light light = null;
            UnityEngine.Object[] array5 = array4;
            for (int j = 0; j < array5.Length; j++)
            {
                Light light2 = (Light)array5[j];
                if (light2.type == LightType.Directional)
                {
                    light = light2;
                    break;
                }
            }
            if (light == null)
            {
                return;
            }
            if (array[0] == "sun_shadowbias")
            {
                float shadowBias = 0f;
                if (!float.TryParse(array[1], out shadowBias))
                {
                    return;
                }
                light.shadowBias = shadowBias;
            }
            if (array[0] == "sun_shadows")
            {
                int num3 = 0;
                if (!int.TryParse(array[1], out num3))
                {
                    return;
                }
                switch (num3)
                {
                case 0:
                    light.shadows = LightShadows.None;
                    break;

                case 1:
                    light.shadows = LightShadows.Hard;
                    break;

                case 2:
                    light.shadows = LightShadows.Soft;
                    break;
                }
            }
        }
        if (array[0] == "shadow_cascades")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num4 = 0;
            if (!int.TryParse(array[1], out num4))
            {
                return;
            }
            switch (num4)
            {
            case 0:
                QualitySettings.shadowCascades = 0;
                break;

            case 1:
                QualitySettings.shadowCascades = 2;
                break;

            case 2:
                QualitySettings.shadowCascades = 4;
                break;
            }
        }
        if (array[0] == "shadow_distance")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num5 = 0;
            if (!int.TryParse(array[1], out num5))
            {
                return;
            }
            QualitySettings.shadowDistance = (float)num5;
        }
        if (array[0] == "shadow_projection")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num6 = 0;
            if (!int.TryParse(array[1], out num6))
            {
                return;
            }
            int num7 = num6;
            if (num7 != 0)
            {
                if (num7 == 1)
                {
                    QualitySettings.shadowProjection = ShadowProjection.StableFit;
                }
            }
            else
            {
                QualitySettings.shadowProjection = ShadowProjection.CloseFit;
            }
        }
        if (array[0] == "fx_ssao")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.ssao == null)
            {
                global::Console.ssao = (ScreenSpaceAmbientOcclusion)UnityEngine.Object.FindObjectOfType(typeof(ScreenSpaceAmbientOcclusion));
            }
            if (global::Console.ssao == null)
            {
                return;
            }
            int num8 = 0;
            if (!int.TryParse(array[1], out num8))
            {
                return;
            }
            if (num8 > 0)
            {
                global::Console.ssao.enabled = true;
            }
            else
            {
                global::Console.ssao.enabled = false;
            }
        }
        if (array[0] == "fx_sharpness")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.sharpness == null)
            {
                global::Console.sharpness = (ContrastEnhance)UnityEngine.Object.FindObjectOfType(typeof(ContrastEnhance));
            }
            if (global::Console.sharpness == null)
            {
                return;
            }
            int num9 = 0;
            if (!int.TryParse(array[1], out num9))
            {
                return;
            }
            if (num9 > 0)
            {
                global::Console.sharpness.enabled = true;
            }
            else
            {
                global::Console.sharpness.enabled = false;
            }
        }
        if (array[0] == "fx_noise")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.noise == null)
            {
                global::Console.noise = (NoiseAndGrain)UnityEngine.Object.FindObjectOfType(typeof(NoiseAndGrain));
            }
            if (global::Console.noise == null)
            {
                return;
            }
            int num10 = 0;
            if (!int.TryParse(array[1], out num10))
            {
                return;
            }
            if (num10 > 0)
            {
                global::Console.noise.enabled = true;
            }
            else
            {
                global::Console.noise.enabled = false;
            }
        }
        if (array[0] == "fx_tone")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.tone == null)
            {
                global::Console.tone = (Tonemapping)UnityEngine.Object.FindObjectOfType(typeof(Tonemapping));
            }
            if (global::Console.tone == null)
            {
                return;
            }
            int num11 = 0;
            if (!int.TryParse(array[1], out num11))
            {
                return;
            }
            if (num11 > 0)
            {
                global::Console.tone.enabled = true;
            }
            else
            {
                global::Console.tone.enabled = false;
            }
        }
        if (array[0] == "fx_vig")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.vig == null)
            {
                global::Console.vig = (VignetteAndChromaticAberration)UnityEngine.Object.FindObjectOfType(typeof(VignetteAndChromaticAberration));
            }
            if (global::Console.vig == null)
            {
                return;
            }
            int num12 = 0;
            if (!int.TryParse(array[1], out num12))
            {
                return;
            }
            if (num12 > 0)
            {
                global::Console.vig.enabled = true;
            }
            else
            {
                global::Console.vig.enabled = false;
            }
        }
        if (array[0] == "fx_dl")
        {
            if (array.Length != 2)
            {
                return;
            }
            if (global::Console.dl == null)
            {
                global::Console.dl = GameObject.Find("Directional light");
            }
            if (global::Console.dl == null)
            {
                return;
            }
            int num13 = 0;
            if (!int.TryParse(array[1], out num13))
            {
                return;
            }
            if (num13 > 0)
            {
                global::Console.dl.SetActive(true);
            }
            else
            {
                global::Console.dl.SetActive(false);
            }
        }
        if (array[0] == "fx_shadowweapon")
        {
            if (array.Length != 2)
            {
                return;
            }
            GameObject gameObject3 = GameObject.Find("maplight");
            if (gameObject3)
            {
                gameObject3.SetActive(false);
            }
        }
        if (array[0] == "fx_lightweapon")
        {
            if (array.Length != 2)
            {
                return;
            }
            GameObject gameObject4 = GameObject.Find("lights");
            if (gameObject4)
            {
                gameObject4.SetActive(false);
            }
        }
        if (array[0] == "devconnect")
        {
            PlayerPrefs.SetInt("localplay", 0);
            array[0] = "connect";
        }
        if (array[0] == "connect")
        {
            if (array.Length < 3)
            {
                Client.cs.Connect();
                return;
            }
            Client.IP = array[1];
            int.TryParse(array[2], out Client.PORT);
            if (array.Length == 4)
            {
                Client.PASSWORD = array[3];
            }
            else
            {
                Client.PASSWORD = string.Empty;
            }
            Client.cs.Connect();
        }
        if (array[0] == "deadcam")
        {
            DeadCam.SetActive(true);
        }
        if (array[0] == "test")
        {
            Award.SetPoints(100);
            Award.SetCustomPoints(23, 0);
        }
        if (array[0] == "sens")
        {
            if (array.Length != 2)
            {
                return;
            }
            float num14;
            if (!float.TryParse(array[1], out num14))
            {
                return;
            }
            vp_FPCamera.SetMouseSensitivity(num14);
            Options.sens = num14;
            PlayerPrefs.SetFloat("sens", num14);
        }
        if (array[0] == "zoomsens")
        {
            if (array.Length != 2)
            {
                return;
            }
            float num15;
            if (!float.TryParse(array[1], out num15))
            {
                return;
            }
            vp_FPCamera.SetZoomSensitivity(num15);
            Options.zoomsens = num15;
            PlayerPrefs.SetFloat("zoomsens", num15);
        }
        if (array[0] == "disconnect")
        {
            GameObject gameObject5 = GameObject.Find("LocalPlayer");
            GameObject gameObject6 = GameObject.Find("Sky");
            GameObject gameObject7 = GameObject.Find("Sky Manager");
            GameObject gameObject8 = GameObject.Find("GUI");
            GameObject gameObject9 = GameObject.Find("Core");
            if (gameObject5)
            {
                UnityEngine.Object.Destroy(gameObject5);
            }
            if (gameObject6)
            {
                UnityEngine.Object.Destroy(gameObject6);
            }
            if (gameObject7)
            {
                UnityEngine.Object.Destroy(gameObject7);
            }
            if (gameObject8)
            {
                UnityEngine.Object.Destroy(gameObject8);
            }
            if (gameObject9)
            {
                UnityEngine.Object.Destroy(gameObject9);
            }
            Client.cs.CloseClient();
            Application.LoadLevel("main");
            Screen.lockCursor = false;
            Cursor.visible    = true;
        }
        if (array[0] == "crosshair_size")
        {
            if (array.Length != 2)
            {
                return;
            }
            int crosshairSize;
            if (!int.TryParse(array[1], out crosshairSize))
            {
                return;
            }
            Crosshair.SetCrosshairSize(crosshairSize);
        }
        if (array[0] == "crosshair_color")
        {
            if (array.Length != 4)
            {
                return;
            }
            int r;
            if (!int.TryParse(array[1], out r))
            {
                return;
            }
            int g;
            if (!int.TryParse(array[2], out g))
            {
                return;
            }
            int b;
            if (!int.TryParse(array[3], out b))
            {
                return;
            }
            Crosshair.SetCrosshairColor(r, g, b);
        }
        if (array[0] == "disableskymanager")
        {
        }
        if (array[0] == "atest")
        {
            Award.SetDeath(26, 0);
        }
        if (array[0] == "chat")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num16;
            if (!int.TryParse(array[1], out num16))
            {
                return;
            }
            if (num16 == 0)
            {
                Message.blockchat = true;
            }
            else
            {
                Message.blockchat = false;
            }
        }
        if (array[0] == "hud")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num17 = 0;
            if (!int.TryParse(array[1], out num17))
            {
                return;
            }
            if (num17 == 0 || num17 == 2)
            {
                HUD.ForceHide(true);
                Crosshair.ForceHide(true);
                Message.ForceHide(true);
                ScoreTop.SetActive(false);
                PlayerNames.SetActive(false);
                GameObject gameObject10 = GameObject.Find("WeaponCamera");
                if (num17 == 2)
                {
                    gameObject10.GetComponent <Camera>().cullingMask = -2147483648;
                    Crosshair.ForceHide(false);
                }
                else
                {
                    gameObject10.GetComponent <Camera>().cullingMask = 0;
                }
            }
            else if (num17 == 3)
            {
                HUD.ForceHide(true);
                Crosshair.ForceHide(true);
                Message.ForceHide(false);
                ScoreTop.SetActive(true);
                PlayerNames.SetActive(true);
                GameObject gameObject11 = GameObject.Find("WeaponCamera");
                gameObject11.GetComponent <Camera>().cullingMask = 0;
            }
            else
            {
                HUD.ForceHide(false);
                Crosshair.ForceHide(false);
                Message.ForceHide(false);
                ScoreTop.SetActive(true);
                PlayerNames.SetActive(true);
                GameObject gameObject12 = GameObject.Find("WeaponCamera");
                gameObject12.GetComponent <Camera>().cullingMask = -2147483648;
            }
        }
        if (array[0] == "spectator")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num18 = 0;
            if (!int.TryParse(array[1], out num18))
            {
                return;
            }
            if (num18 == 1)
            {
                SpecCam.show = true;
                Client.cs.send_chooseteam(255);
                GameObject gameObject13 = GameObject.Find("WeaponCamera");
                gameObject13.GetComponent <Camera>().cullingMask = 0;
            }
            else
            {
                SpecCam.show = false;
                Client.cs.send_chooseteam(3);
                GameObject gameObject14 = GameObject.Find("WeaponCamera");
                gameObject14.GetComponent <Camera>().cullingMask = -2147483648;
            }
        }
        if (array[0] == "m_steps")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num19 = 0;
            if (!int.TryParse(array[1], out num19))
            {
                return;
            }
            if (num19 > 20)
            {
                num19 = 20;
            }
            if (num19 < 1)
            {
                num19 = 1;
            }
            vp_FPCamera.MouseSmoothSteps = num19;
        }
        if (array[0] == "m_weight")
        {
            if (array.Length != 2)
            {
                return;
            }
            float num20 = 0f;
            if (!float.TryParse(array[1], out num20))
            {
                return;
            }
            if (num20 > 1f)
            {
                num20 = 1f;
            }
            if (num20 < 0f)
            {
                num20 = 0f;
            }
            vp_FPCamera.MouseSmoothWeight = num20;
        }
        if (array[0] == "extralod")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num21 = 0;
            if (!int.TryParse(array[1], out num21))
            {
                return;
            }
            if (num21 == 0)
            {
                PlayerControll.extralod = false;
            }
            else
            {
                PlayerControll.extralod = true;
            }
        }
        if (array[0] == "showfps")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num22 = 0;
            if (!int.TryParse(array[1], out num22))
            {
                return;
            }
            if (num22 == 0)
            {
                global::Console.showfps = false;
            }
            else
            {
                global::Console.showfps = true;
            }
        }
        if (array[0] == "ping")
        {
            if (PlayerPrefs.GetString("devpass") != "6f66a0d73e9894e62fe0ee48c209911b")
            {
                return;
            }
            if (array.Length != 2)
            {
                return;
            }
            int num23 = 0;
            if (!int.TryParse(array[1], out num23))
            {
                return;
            }
            PlayerPrefs.SetInt("ShowPing", num23);
            if (num23 == 1)
            {
                global::Ping.cs.ShowPing(true);
            }
            else
            {
                global::Ping.cs.ShowPing(false);
            }
        }
        if (array[0] == "nord")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num24 = 0;
            if (!int.TryParse(array[1], out num24))
            {
                return;
            }
            if (num24 == 0)
            {
                PlayerControll.nord = false;
            }
            else
            {
                PlayerControll.nord = true;
            }
        }
        if (array[0] == "devunlock")
        {
        }
        if (array[0] == "devnext")
        {
        }
        if (array[0] == "forcewin")
        {
            Client.cs.send_consolecmd(array[0], string.Empty);
        }
        if (array[0] == "name")
        {
            if (array.Length != 2)
            {
                return;
            }
            MonoBehaviour.print(array[0] + array[1]);
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "kill")
        {
            Client.cs.send_consolecmd(array[0], string.Empty);
        }
        else if (array[0] == "rcon")
        {
            if (array.Length != 2)
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "kick")
        {
            if (array.Length != 2)
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "banlist")
        {
            Client.cs.send_consolecmd(array[0], string.Empty);
        }
        else if (array[0] == "ban")
        {
            if (array.Length != 2)
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "password")
        {
            if (array.Length != 2)
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "startmoney")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num25;
            if (!int.TryParse(array[1], out num25))
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "fraglimit")
        {
            if (array.Length != 2)
            {
                return;
            }
            int num26;
            if (!int.TryParse(array[1], out num26))
            {
                return;
            }
            Client.cs.send_consolecmd(array[0], array[1]);
        }
        else if (array[0] == "rr" || array[0] == "restart")
        {
            Client.cs.send_consolecmd(array[0], string.Empty);
        }
        else if (array[0] == "live")
        {
            Client.cs.send_consolecmd(array[0], string.Empty);
        }
        else if (array[0] == "skin_test")
        {
            if (array.Length != 2)
            {
                return;
            }
            Texture2D   textureByName = TEX.GetTextureByName(array[1]);
            vp_FPWeapon vp_FPWeapon   = (vp_FPWeapon)UnityEngine.Object.FindObjectOfType(typeof(vp_FPWeapon));
            if (vp_FPWeapon.m_WeaponCoreModel != null && textureByName != null)
            {
                Component[] componentsInChildren = vp_FPWeapon.m_WeaponCoreModel.GetComponentsInChildren(typeof(Renderer));
                for (int k = 0; k < componentsInChildren.Length; k++)
                {
                    Renderer renderer = (Renderer)componentsInChildren[k];
                    if (!(renderer.name == "merc_hands"))
                    {
                        if (!(renderer.name == "warcorp_hands"))
                        {
                            renderer.materials[0].SetTexture(0, textureByName);
                        }
                    }
                }
            }
        }
    }
Exemple #18
0
    /// <summary>
    /// 
    /// </summary>
    protected override void Start()
    {
        base.Start();

        // defaults for using animation length as the fire and reload delay
        if (ProjectileFiringRate == 0.0f && AnimationFire != null)
            ProjectileFiringRate = AnimationFire.length;

        // store a reference to the FPSWeapon
        m_FPSWeapon = transform.GetComponent<vp_FPWeapon>();

        // defaults for using animation length as the fire delay
        if (ProjectileFiringRate == 0.0f && AnimationFire != null)
            ProjectileFiringRate = AnimationFire.length;
    }
Exemple #19
0
        private void Update()
        {
            /*if (!Input.anyKey || !Input.anyKeyDown) {
             *  return;
             * }*/

            if (noWeaponBob && O.localPlayer)
            {
                vp_FPWeapon weapon = O.localPlayer.vp_FPWeapon;

                if (weapon)
                {
                    weapon.BobRate              = Vector4.zero;
                    weapon.ShakeAmplitude       = Vector3.zero;
                    weapon.RenderingFieldOfView = 120f;
                    weapon.StepForceScale       = 0f;
                }
            }

            if (Input.GetKeyDown(KeyCode.O))
            {
                if (!O.localPlayer)
                {
                    return;
                }

                Inventory inventory = O.localPlayer.inventory;

                if (inventory != null)
                {
                    ItemActionAttack gun = inventory.GetHoldingGun();

                    if (gun != null)
                    {
                        gun.InfiniteAmmo = !gun.InfiniteAmmo;
                    }
                }
            }

            if (Input.GetKey(KeyCode.LeftAlt) && magicBullet)
            {
                MagicBullet();
            }

            if (Input.GetKey(KeyCode.LeftAlt) && O.zombieList.Count > 0 && aimbot)
            {
                Aimbot();
            }

            if (Input.GetKeyDown(KeyCode.F2))
            {
                speed = !speed;

                Time.timeScale = speed ? 6f : 1f;
            }

            if (Time.time >= lastChamTime && chams)
            {
                foreach (Entity entity in FindObjectsOfType <Entity>())
                {
                    if (!entity)
                    {
                        continue;
                    }

                    switch (entity.entityType)
                    {
                    case EntityType.Zombie:
                        ApplyChams(entity, Color.red);
                        break;

                    case EntityType.Player:
                        ApplyChams(entity, Color.cyan);
                        break;

                    case EntityType.Animal:
                        ApplyChams(entity, Color.yellow);
                        break;

                    case EntityType.Unknown:
                        ApplyChams(entity, Color.white);
                        break;
                    }
                }

                lastChamTime = Time.time + 10f;
            }
        }
Exemple #20
0
 /// <summary>
 ///
 /// </summary>
 protected virtual void Start()
 {
     // store a reference to the FPSWeapon
     m_Weapon = transform.GetComponent <vp_FPWeapon>();
 }
    /// <summary>
    /// 
    /// </summary>
    protected override void Start()
    {
        base.Start();

        m_Controller = (vp_FPController)Root.GetComponent(typeof(vp_FPController));
        m_Camera = (vp_FPCamera)Root.GetComponentInChildren(typeof(vp_FPCamera));
        m_Weapon = (vp_FPWeapon)Transform.GetComponent(typeof(vp_FPWeapon));
    }