/// <summary>
    ///
    /// </summary>
    void Start()
    {
        // Make the rigid body not change rotation
        if (rigidbody)
        {
            rigidbody.freezeRotation = true;
        }

        menu = GameObject.Find("_GameManager").GetComponent <bl_RoomMenu>();
        cmra = GameObject.FindWithTag("MainCamera");
        // Make the rigid body not change rotation
        if (rigidbody)
        {
            rigidbody.freezeRotation = true;
        }
        originalRotation = transform.localRotation;

        if (PlayerPrefs.HasKey("sensitive"))
        {
            sensitivityX = PlayerPrefs.GetFloat("sensitive");
            sensitivityY = PlayerPrefs.GetFloat("sensitive");
        }
        else
        {
            sensitivityX = 6;
            sensitivityY = 6;
        }
        sX = sensitivityX;
        sY = sensitivityY;
        if (isPlayer)
        {
            m_Gun = this.transform.root.GetComponentInChildren <bl_GunManager>().CurrentGun;
        }
    }
Beispiel #2
0
    /// <summary>
    ///
    /// </summary>
    void Start()
    {
        // Make the rigid body not change rotation
        if (GetComponent <Rigidbody>())
        {
            GetComponent <Rigidbody>().freezeRotation = true;
        }

        menu = FindObjectOfType <bl_RoomMenu>();
        cmra = GameObject.FindWithTag("MainCamera");
        // Make the rigid body not change rotation
        if (GetComponent <Rigidbody>())
        {
            GetComponent <Rigidbody>().freezeRotation = true;
        }
        originalRotation = transform.localRotation;

        sensitivityX = PlayerPrefs.GetFloat("sensitive", 4);
        sensitivityY = PlayerPrefs.GetFloat("sensitive", 4);

        sX = sensitivityX;
        sY = sensitivityY;

        if (isPlayer)
        {
            m_Gun = this.transform.root.GetComponentInChildren <bl_GunManager>().CurrentGun;
        }
    }
Beispiel #3
0
 public void Awake()
 {
     this.myTransform = this.transform;
     DefaultRot = myTransform.localRotation;
     DefaultPos = myTransform.localPosition;
     controller = this.transform.root.GetComponent<bl_PlayerMovement>();
     Gun = transform.parent.GetComponent<bl_Gun>();
 }
Beispiel #4
0
 public void Awake()
 {
     this.myTransform = this.transform;
     DefaultRot       = myTransform.localRotation;
     DefaultPos       = myTransform.localPosition;
     controller       = this.transform.root.GetComponent <bl_PlayerMovement>();
     Gun = transform.parent.GetComponent <bl_Gun>();
 }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 protected override void Awake()
 {
     base.Awake();
     this.myTransform = this.transform;
     DefaultRot       = myTransform.localRotation;
     DefaultPos       = myTransform.localPosition;
     controller       = this.transform.root.GetComponent <bl_FirstPersonController>();
     Gun = transform.parent.GetComponent <bl_Gun>();
 }
Beispiel #6
0
    /// <summary>
    ///
    /// </summary>
    void Update()
    {
        if (!bl_UtilityHelper.GetCursorState)
        {
            return;
        }

        InputControl();
        CurrentGun = PlayerEquip[m_Current];
    }
Beispiel #7
0
    void Awake()
    {
        m_gun      = this.GetComponent <bl_Gun>();
        ScopeImage = GameObject.FindWithTag("GameManager").GetComponent <bl_Crosshair>().SniperScopeImage;

        if (ScopeImage)
        {
            ScopeImage.sprite = Scope;
            Alpha             = ScopeImage.gameObject.GetComponent <CanvasGroup>();
            DistanceText      = ScopeImage.gameObject.GetComponentInChildren <Text>();
        }
    }
Beispiel #8
0
    /// <summary>
    ///
    /// </summary>
    void Update()
    {
        CurrentGun = GManager.CurrentGun;
        if (BulletLeft != CurrentGun.bulletsLeft)
        {
            BulletLeft = Mathf.Lerp(BulletLeft, CurrentGun.bulletsLeft, Time.deltaTime * BulletFactorReconpen);
        }
        Clips = CurrentGun.numberOfClips;

        if (BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Machinegun || BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Burst || BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Pistol)
        {
            m_color = Color.Lerp(m_color, AmmoLow, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);
        }
        else if (CurrentGun.typeOfGun == bl_Gun.weaponType.Shotgun && BulletLeft <= isLowBulletSniper || CurrentGun.typeOfGun == bl_Gun.weaponType.Sniper && BulletLeft <= isLowBulletSniper)
        {
            m_color = Color.Lerp(m_color, AmmoLow, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);
        }
        else
        {
            m_color = Color.Lerp(m_color, AmmoNormal, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);
        }

        if (AmmoTextUI != null)
        {
            if (CurrentGun.typeOfGun != bl_Gun.weaponType.Knife)
            {
                AmmoTextUI.text = bl_UtilityHelper.GetThreefoldChar(BulletLeft) + "/<size=10>" + Clips + "</size>";
            }
            else
            {
                AmmoTextUI.text = "-- / <size=8>--</size>";
            }
            AmmoTextUI.color = m_color;
        }

        if (weaponNameText != null)
        {
            weaponNameText.text = CurrentGun.GunName;
        }

        if (Noti_Time.Count > 0)
        {
            for (int i = 0; i < Noti_Time.Count; i++)
            {
                Noti_Time[i] -= Time.deltaTime;
                if (Noti_Time[i] <= 0.0f)
                {
                    Notifications.RemoveAt(i);
                    Noti_Time.RemoveAt(i);
                }
            }
        }
    }
Beispiel #9
0
    void Awake()
    {
        m_gun = this.GetComponent<bl_Gun>();
        ScopeImage = GameObject.FindWithTag("GameManager").GetComponent<bl_Crosshair>().SniperScopeImage;

        if (ScopeImage)
        {
            ScopeImage.sprite = Scope;
            Alpha = ScopeImage.gameObject.GetComponent<CanvasGroup>();
            DistanceText = ScopeImage.gameObject.GetComponentInChildren<Text>();
        }
    }
    /// <summary>
    ///
    /// </summary>
    protected override void Awake()
    {
        base.Awake();
        m_gun      = GetComponent <bl_Gun>();
        ScopeImage = bl_UIReferences.Instance.SniperScope;

        if (ScopeImage)
        {
            ScopeImage.sprite = Scope;
            Alpha             = ScopeImage.gameObject.GetComponent <CanvasGroup>();
            DistanceText      = ScopeImage.gameObject.GetComponentInChildren <Text>();
        }
    }
    public bl_Gun GetGunOnListById(int id)
    {
        bl_Gun gun = null;

        if (AllGuns.Exists(x => x != null && x.GunID == id))
        {
            gun = AllGuns.Find(x => x.GunID == id);
        }
        else
        {
            Debug.LogError("Gun: " + id + " has not been added on this player list.");
        }
        return(gun);
    }
Beispiel #12
0
        public void PrepareToExport(bl_Gun fpweapon, bl_PlayerSync player)
        {
            FPWeapon = fpweapon;
            Player   = player;
            if (FPWeapon == null || Player == null)
            {
                return;
            }
            NetworkGun = Player.NetworkGuns.Find(x => x.LocalGun.GunID == FPWeapon.GunID);
            isExport   = true;

            minSize = new Vector2(200, 150);
            maxSize = new Vector2(250, 200);
        }
 /// <summary>
 ///
 /// </summary>
 void Awake()
 {
     if (ParentGun == null)
     {
         ParentGun = transform.parent.GetComponent <bl_Gun>();
     }
     GunManager = transform.root.GetComponentInChildren <bl_GunManager>();
     GunBob     = GunManager.GetComponent <bl_GunBob>();
     m_source   = GetComponent <AudioSource>();
     if (m_source == null)
     {
         m_source             = gameObject.AddComponent <AudioSource>();
         m_source.playOnAwake = false;
     }
 }
Beispiel #14
0
        void SetupPlayerWeapons()
        {
            bl_Gun gun = script.GetComponent <bl_Gun>();

            if (gun != null)
            {
                int gunID = gun.GunID;
                script.WeaponID   = bl_CustomizerData.Instance.GetCustomizerID(gunID);
                script.WeaponName = bl_CustomizerData.Instance.Weapons[script.WeaponID].WeaponName;
                bl_CustomizerManager cm = FindObjectOfType <bl_CustomizerManager>();
                if (cm != null)
                {
                    bl_Customizer[] all = cm.transform.GetComponentsInChildren <bl_Customizer>(true);
                    for (int i = 0; i < all.Length; i++)
                    {
                        if (all[i].WeaponID == script.WeaponID)
                        {
                            _CustomizerWeapon  = all[i];
                            customizerSelected = i;
                        }
                    }
                    if (_CustomizerWeapon != null)
                    {
                        script.BuildAttachments();
                        script.CamoRender.MaterialID = _CustomizerWeapon.CamoRender.MaterialID;
                        Mesh         mesh = _CustomizerWeapon.CamoRender.Render.GetComponent <MeshFilter>().sharedMesh;
                        MeshFilter[] allm = script.transform.GetComponentsInChildren <MeshFilter>(true);
                        for (int i = 0; i < allm.Length; i++)
                        {
                            if (allm[i].sharedMesh == mesh)
                            {
                                script.CamoRender.Render = allm[i].GetComponent <MeshRenderer>();
                                _TargetMesh = script.CamoRender.Render.transform;
                            }
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Can't find the Customizer weapon with GunID: " + gunID);
                    }
                }
            }
            else
            {
                Debug.LogWarning("You only can setup customizer weapon from the FPWeapon");
            }
        }
Beispiel #15
0
 /// <summary>
 ///
 /// </summary>
 private void OnEnable()
 {
     if (photonView == null)
     {
         photonView = transform.root.GetComponent <PhotonView>();
     }
     if (isFPWeapon && !isSync)
     {
         LoadAttachments();
         ApplyAttachments();
         Gun = GetComponent <bl_Gun>();
         string line = bl_CustomizerData.Instance.CompileArray(AttachmentsIds);
         photonView.RPC("SyncCustomizer", RpcTarget.Others, Gun.GunID, line);
         isSync = true;
         bl_PhotonCallbacks.PlayerEnteredRoom += OnNewPlayerEnter;
     }
 }
 private void OnEnable()
 {
     script = (bl_WeaponAnimation)target;
     Gun    = script.transform.parent.GetComponent <bl_Gun>();
     gType  = bl_GameData.Instance.GetWeapon(Gun.GunID).Type;
     if (script.m_AnimationType == bl_WeaponAnimation.AnimationType.Animator)
     {
         _animator = script.GetComponent <Animator>();
     }
     list = new ReorderableList(serializedObject, serializedObject.FindProperty("FireAnimations"), true, true, true, true);
     list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
     {
         var element = list.serializedProperty.GetArrayElementAtIndex(index);
         rect.y += 2;
         EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
     };
     list.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Fire Animations"); };
 }
Beispiel #17
0
    /// <summary>
    ///
    /// </summary>
    public override void OnUpdate()
    {
        CurrentGun = GManager.GetCurrentWeapon();
        BulletLeft = CurrentGun.bulletsLeft;
        Clips      = CurrentGun.numberOfClips;

        if (BulletLeft <= isLowBullet && CurrentGun.Info.Type == GunType.Machinegun || BulletLeft <= isLowBullet && CurrentGun.Info.Type == GunType.Burst || BulletLeft <= isLowBullet && CurrentGun.Info.Type == GunType.Pistol)
        {
            m_color = Color.Lerp(m_color, AmmoLow, Time.deltaTime * 8);
        }
        else if (CurrentGun.Info.Type == GunType.Shotgun && BulletLeft <= isLowBulletSniper || CurrentGun.Info.Type == GunType.Sniper && BulletLeft <= isLowBulletSniper)
        {
            m_color = Color.Lerp(m_color, AmmoLow, Time.deltaTime * 8);
        }
        else
        {
            m_color = Color.Lerp(m_color, AmmoNormal, Time.deltaTime * 8);
        }

        if (AmmoTextUI != null)
        {
            if (CurrentGun.Info.Type != GunType.Knife)
            {
                AmmoTextUI.text = BulletLeft.ToString("F0");
            }
            else
            {
                AmmoTextUI.text = "--";
            }
            AmmoTextUI.color = m_color;
        }
        if (ClipText != null)
        {
            if (CurrentGun.Info.Type != GunType.Knife)
            {
                ClipText.text = string.Format("/ {0}", Clips.ToString("F0"));
            }
            else
            {
                ClipText.text = "/ --";
            }
            ClipText.color = m_color;
        }
    }
Beispiel #18
0
 /// <summary>
 ///
 /// </summary>
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1) && CanSwich && m_Current != 0)
     {
         StartCoroutine(ChangeGun(PlayerEquip[m_Current].gameObject, PlayerEquip[0].gameObject));
         m_Current = 0;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2) && CanSwich && m_Current != 1)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[1].gameObject));
         m_Current = 1;
     }
     if (Input.GetKeyDown(KeyCode.Alpha3) && CanSwich && m_Current != 2)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[2].gameObject));
         m_Current = 2;
     }
     if (Input.GetKeyDown(KeyCode.Alpha4) && CanSwich && m_Current != 3)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[3].gameObject));
         m_Current = 3;
     }
     //change gun with Scroll mouse
     if (Input.GetAxis("Mouse ScrollWheel") > 0f)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[(this.m_Current + 1) % this.PlayerEquip.Count].gameObject));
         m_Current = (this.m_Current + 1) % this.PlayerEquip.Count;
     }
     if (Input.GetAxis("Mouse ScrollWheel") < 0f)
     {
         if (this.m_Current != 0)
         {
             StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[(this.m_Current - 1) % this.PlayerEquip.Count].gameObject));
             this.m_Current = (this.m_Current - 1) % this.PlayerEquip.Count;
         }
         else
         {
             StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[this.PlayerEquip.Count - 1].gameObject));
             this.m_Current = this.PlayerEquip.Count - 1;
         }
     }
     CurrentGun = PlayerEquip[m_Current];
 }
 /// <summary>
 ///
 /// </summary>
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1) && CanSwich && m_Current != 0)
     {
         StartCoroutine(ChangeGun(PlayerEquip[m_Current].gameObject, PlayerEquip[0].gameObject));
         m_Current = 0;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2) && CanSwich && m_Current != 1)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[1].gameObject));
         m_Current = 1;
     }
     if (Input.GetKeyDown(KeyCode.Alpha3) && CanSwich && m_Current != 2)
     {
         StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[2].gameObject));
         m_Current = 2;
     }
     CurrentGun = PlayerEquip[m_Current];
 }
    public void UpdateWeaponState(bl_Gun gun)
    {
        int   bullets = gun.bulletsLeft;
        int   clips   = gun.numberOfClips;
        float per     = (float)bullets / (float)gun.bulletsPerClip;
        Color c       = AmmoTextColorGradient.Evaluate(per);

        if (gun.Info.Type != GunType.Knife)
        {
            AmmoText.text  = bullets.ToString();
            ClipText.text  = ClipText.text = string.Format("/ {0}", clips.ToString("F0"));
            AmmoText.color = c;
            ClipText.color = c;
        }
        else
        {
            AmmoText.text  = "--";
            ClipText.text  = ClipText.text = "/ --";
            AmmoText.color = Color.white;
            ClipText.color = Color.white;
        }
    }
 private void OnEnable()
 {
     list = new ReorderableList(serializedObject, serializedObject.FindProperty(Dependency.GOListPropiertie), true, true, true, true);
     list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
     {
         var element = list.serializedProperty.GetArrayElementAtIndex(index);
         rect.y += 2;
         EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
     };
     list.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "On No Ammo Desactive"); };
     GameData       = bl_GameData.Instance;
     script         = (bl_Gun)target;
     playerSettings = script.transform.root.GetComponent <bl_PlayerSettings>();
     if (playerSettings != null)
     {
         AimReference = playerSettings.m_hands.AimPositionReference;
     }
     AimIcon = new GUIContent(EditorGUIUtility.IconContent("Main Light Gizmo").image);
     if (script != null)
     {
         GunManager = script.transform.parent.GetComponent <bl_GunManager>();
     }
 }
 /// <summary>
 ///
 /// </summary>
 public void ReplaceSlot(int slot, bl_Gun newGun)
 {
     IconsImg[slot].sprite = newGun.Info.GunIcon;
 }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        bl_Gun script            = (bl_Gun)target;
        bool   allowSceneObjects = !EditorUtility.IsPersistent(script);

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.LabelField("", "Gun Info", "box");
        script.typeOfGun = (bl_Gun.weaponType)EditorGUILayout.EnumPopup("Type of Gun ", script.typeOfGun);

        if (script.typeOfGun != bl_Gun.weaponType.Launcher)
        {
            script.typeOfBullet = (bl_Gun.BulletType)EditorGUILayout.EnumPopup("Type of Ammo ", script.typeOfBullet);
        }
        //
        script.GunID           = EditorGUILayout.IntField("Gun ID ", script.GunID);
        script.GunName         = EditorGUILayout.TextField("Gun Name", script.GunName);
        script.localPlayerName = EditorGUILayout.TextField("Player Name", script.localPlayerName);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");

        if (script.typeOfGun == bl_Gun.weaponType.Machinegun || script.typeOfGun == bl_Gun.weaponType.Pistol || script.typeOfGun == bl_Gun.weaponType.Sniper)
        {
            EditorGUILayout.LabelField("", "Gun Settings", "box");
            EditorGUILayout.BeginVertical("box");
            script.AimPosition = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth   = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth   = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 0.01f, 15f);
            script.AimSway     = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimFog      = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.shell       = EditorGUILayout.ObjectField("Shell", script.shell, typeof(UnityEngine.Rigidbody), allowSceneObjects) as UnityEngine.Rigidbody;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.mountPoint  = EditorGUILayout.ObjectField("Mount Point", script.mountPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.ejectPoint  = EditorGUILayout.ObjectField("Eject Point", script.ejectPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(UnityEngine.Renderer), allowSceneObjects) as UnityEngine.Renderer;
            script.lightFlash   = EditorGUILayout.ObjectField("Fire Light", script.lightFlash, typeof(UnityEngine.Light), allowSceneObjects) as UnityEngine.Light;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.bulletHole   = EditorGUILayout.ObjectField("Bullet Hole", script.bulletHole, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", "box");
            script.fireRate       = EditorGUILayout.FloatField("Fire Rate", script.fireRate);
            script.damage         = EditorGUILayout.FloatField("Damage", script.damage);
            script.range          = EditorGUILayout.IntField("Range", script.range);
            script.bulletSpeed    = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce    = EditorGUILayout.IntSlider("Imapact Force", script.impactForce, 0, 30);
            script.maxPenetration = EditorGUILayout.IntSlider("Max Penetration", (int)script.maxPenetration, 1, 6);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.ShakeSmooth    = EditorGUILayout.FloatField("Shake Smooth", script.ShakeSmooth);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.reloadTime       = EditorGUILayout.FloatField("Reload Time", script.reloadTime);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            if (script.typeOfGun == bl_Gun.weaponType.Sniper)
            {
                script.delayForSecondFireSound = EditorGUILayout.Slider("Delay Second Fire Sound", script.delayForSecondFireSound, 0.0f, 2.0f);
                script.DelaySource             = EditorGUILayout.ObjectField("Second Source", script.DelaySource, typeof(UnityEngine.AudioSource), allowSceneObjects) as UnityEngine.AudioSource;
            }
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.typeOfGun == bl_Gun.weaponType.Burst)
        {
            EditorGUILayout.LabelField("", "Gun Settings", "box");
            EditorGUILayout.BeginVertical("box");
            script.AimPosition = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth   = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth   = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway     = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimFog      = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.shell       = EditorGUILayout.ObjectField("Shell", script.shell, typeof(UnityEngine.Rigidbody), allowSceneObjects) as UnityEngine.Rigidbody;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.mountPoint  = EditorGUILayout.ObjectField("Mount Point", script.mountPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.ejectPoint  = EditorGUILayout.ObjectField("Eject Point", script.ejectPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(UnityEngine.Renderer), allowSceneObjects) as UnityEngine.Renderer;
            script.lightFlash   = EditorGUILayout.ObjectField("Fire Light", script.lightFlash, typeof(UnityEngine.Light), allowSceneObjects) as UnityEngine.Light;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.bulletHole   = EditorGUILayout.ObjectField("Bullet Hole", script.bulletHole, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", "box");
            script.fireRate        = EditorGUILayout.FloatField("Fire Rate", script.fireRate);
            script.roundsPerBurst  = EditorGUILayout.IntSlider("Rounds Per Burst", script.roundsPerBurst, 1, 10);
            script.lagBetweenShots = EditorGUILayout.Slider("Lag Between Shots", script.lagBetweenShots, 0.01f, 5.0f);
            script.damage          = EditorGUILayout.FloatField("Damage", script.damage);
            script.range           = EditorGUILayout.IntField("Range", script.range);
            script.bulletSpeed     = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce     = EditorGUILayout.IntField("Impact Force", script.impactForce);
            script.maxPenetration  = EditorGUILayout.IntSlider("Max Penetration", (int)script.maxPenetration, 1, 6);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.ShakeSmooth    = EditorGUILayout.FloatField("Shake Smooth", script.ShakeSmooth);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.reloadTime       = EditorGUILayout.FloatField("Reload Time", script.reloadTime);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound         = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.typeOfGun == bl_Gun.weaponType.Shotgun)
        {
            EditorGUILayout.LabelField("", "ShotGun Settings", "box");
            EditorGUILayout.BeginVertical("box");
            script.AimPosition = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth   = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth   = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway     = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimFog      = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.shell       = EditorGUILayout.ObjectField("Shell", script.shell, typeof(UnityEngine.Rigidbody), allowSceneObjects) as UnityEngine.Rigidbody;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.mountPoint  = EditorGUILayout.ObjectField("Mount Point", script.mountPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            script.ejectPoint  = EditorGUILayout.ObjectField("Eject Point", script.ejectPoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(UnityEngine.Renderer), allowSceneObjects) as UnityEngine.Renderer;
            script.lightFlash   = EditorGUILayout.ObjectField("Fire Light", script.lightFlash, typeof(UnityEngine.Light), allowSceneObjects) as UnityEngine.Light;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.bulletHole   = EditorGUILayout.ObjectField("Bullet Hole", script.bulletHole, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", "box");
            script.fireRate        = EditorGUILayout.FloatField("Fire Rate", script.fireRate);
            script.damage          = EditorGUILayout.FloatField("Damage", script.damage);
            script.pelletsPerShot  = EditorGUILayout.IntSlider("Bullets Per Shots", (int)script.pelletsPerShot, 1, 10);
            script.roundsPerTracer = EditorGUILayout.IntSlider("Rounds Per Tracer", (int)script.roundsPerTracer, 1, 5);
            script.range           = EditorGUILayout.IntField("Range", script.range);
            script.bulletSpeed     = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce     = EditorGUILayout.IntField("Impact Force", script.impactForce);
            script.maxPenetration  = EditorGUILayout.IntSlider("Max Penetration", (int)script.maxPenetration, 1, 6);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.ShakeSmooth    = EditorGUILayout.FloatField("Shake Smooth", script.ShakeSmooth);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.reloadTime       = EditorGUILayout.FloatField("Reload Time", script.reloadTime);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.delayForSecondFireSound = EditorGUILayout.Slider("Delay Second Fire Sound", script.delayForSecondFireSound, 0.0f, 2.0f);
            script.DelaySource             = EditorGUILayout.ObjectField("Second Source", script.DelaySource, typeof(UnityEngine.AudioSource), allowSceneObjects) as UnityEngine.AudioSource;
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.typeOfGun == bl_Gun.weaponType.Launcher)
        {
            EditorGUILayout.LabelField("", "Launcher Settings", "box");
            EditorGUILayout.BeginVertical("box");
            script.AimPosition = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth   = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth   = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway     = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimFog      = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.grenade     = EditorGUILayout.ObjectField("Grenade", script.grenade, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Launcher properties", "box");
            script.fireRate       = EditorGUILayout.FloatField("Fire Rate", script.fireRate);
            script.DelayFire      = EditorGUILayout.FloatField("Delay Fire", script.DelayFire);
            script.damage         = EditorGUILayout.FloatField("Damage", script.damage);
            script.range          = EditorGUILayout.IntField("Range", script.range);
            script.bulletSpeed    = EditorGUILayout.FloatField("Projectil Speed", script.bulletSpeed);
            script.impactForce    = EditorGUILayout.IntField("Impact Force", script.impactForce);
            script.maxPenetration = EditorGUILayout.IntSlider("Max Penetration", (int)script.maxPenetration, 1, 6);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.ShakeSmooth    = EditorGUILayout.FloatField("Shake Smooth", script.ShakeSmooth);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.reloadTime       = EditorGUILayout.FloatField("Reload Time", script.reloadTime);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.Space();

            ReorderableListGUI.Title("On Not Ammo Disable");
            ReorderableListGUI.ListField(GOList);

            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound         = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.EndVertical();
        serializedObject.ApplyModifiedProperties();
    }
 /// <summary>
 ///
 /// </summary>
 void Awake()
 {
     m_gun = this.GetComponent <bl_Gun>();
 }
Beispiel #25
0
 public void ChangeType(bl_Gun.weaponType _type)
 {
     m_WeaponType = _type;
     isIdle = false;
 }
Beispiel #26
0
    void Update()
    {
        CurrentGun = GManager.CurrentGun;
        if (BulletLeft != CurrentGun.bulletsLeft)
            BulletLeft = Mathf.Lerp(BulletLeft, CurrentGun.bulletsLeft, Time.deltaTime * BulletFactorReconpen);
           // BulletLeft = CurrentGun.bulletsLeft;
        Clips = CurrentGun.numberOfClips;

        if (BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Machinegun || BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Burst || BulletLeft <= isLowBullet && CurrentGun.typeOfGun == bl_Gun.weaponType.Pistol)
            m_color = Color.Lerp(m_color, AmmoLow, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);
        else if (CurrentGun.typeOfGun == bl_Gun.weaponType.Shotgun && BulletLeft <= isLowBulletSniper || CurrentGun.typeOfGun == bl_Gun.weaponType.Sniper && BulletLeft <= isLowBulletSniper)
            m_color = Color.Lerp(m_color, AmmoLow, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);
        else
            m_color = Color.Lerp(m_color, AmmoNormal, (Seno(6.0f, 0.1f, 0.0f) * 5) + 0.5f);

        if (AmmoTextUI != null)
        {
            if (CurrentGun.typeOfGun != bl_Gun.weaponType.Knife)
                AmmoTextUI.text = bl_UtilityHelper.GetThreefoldChar(BulletLeft) + "/<size=10>" + Clips + "</size>";
            else
                AmmoTextUI.text = "-- / <size=10>--</size>";
            AmmoTextUI.color = m_color;
        }

        if (Noti_Time.Count > 0)
        {
            for (int i = 0; i < Noti_Time.Count; i++)
            {
                Noti_Time[i] -= Time.deltaTime;
                if (Noti_Time[i] <= 0.0f)
                {
                    Notifications.RemoveAt(i);
                    Noti_Time.RemoveAt(i);
                }
            }
        }
    }
Beispiel #27
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1) && CanSwich && m_Current != 0)
        {
            StartCoroutine(ChangeGun(PlayerEquip[m_Current].gameObject,PlayerEquip[0].gameObject));
             m_Current = 0;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2) && CanSwich && m_Current != 1)
        {
            StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject),PlayerEquip[1].gameObject));
            m_Current = 1;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3) && CanSwich && m_Current != 2)
        {
            StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[2].gameObject));
            m_Current = 2;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4) && CanSwich && m_Current != 3)
        {
            StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[3].gameObject));
            m_Current = 3;
        }
        //change gun with Scroll mouse
        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
            StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[(this.m_Current + 1) % this.PlayerEquip.Count].gameObject));
            m_Current = (this.m_Current + 1) % this.PlayerEquip.Count;
        }
        if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            if (this.m_Current != 0)
            {
                StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[(this.m_Current - 1) % this.PlayerEquip.Count].gameObject));
                this.m_Current = (this.m_Current - 1) % this.PlayerEquip.Count;
            }
            else
            {
                StartCoroutine(ChangeGun((PlayerEquip[m_Current].gameObject), PlayerEquip[this.PlayerEquip.Count - 1].gameObject));
                this.m_Current = this.PlayerEquip.Count - 1;
            }

        }
        CurrentGun = PlayerEquip[m_Current];
    }
Beispiel #28
0
    void Start()
    {
        // Make the rigid body not change rotation
        if (GetComponent<Rigidbody>()) GetComponent<Rigidbody>().freezeRotation = true;

        menu = GameObject.Find("_GameManager").GetComponent<bl_RoomMenu>();
        cmra = GameObject.FindWithTag("MainCamera");
        // Make the rigid body not change rotation
        if (GetComponent<Rigidbody>())
            GetComponent<Rigidbody>().freezeRotation = true;
        originalRotation = transform.localRotation;

        if (PlayerPrefs.HasKey("sensitive"))
        {
            sensitivityX = PlayerPrefs.GetFloat("sensitive");
            sensitivityY = PlayerPrefs.GetFloat("sensitive");
        }
        else
        {
            sensitivityX = 6;
            sensitivityY = 6;
        }
        sX = sensitivityX;
        sY = sensitivityY;
        if(isPlayer)
        m_Gun = this.transform.root.GetComponentInChildren<bl_GunManager>().CurrentGun;
    }
Beispiel #29
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        bl_Gun script            = (bl_Gun)target;
        bool   allowSceneObjects = !EditorUtility.IsPersistent(script);

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.LabelField("", "Gun Info", EditorStyles.toolbar);
        script.GunID          = EditorGUILayout.Popup("Gun ID ", script.GunID, GameData.AllWeaponStringList());
        script.Info.Type      = bl_GameData.Instance.GetWeapon(script.GunID).Type;
        script.CrossHairScale = EditorGUILayout.Slider("CrossHair Scale: ", script.CrossHairScale, 1, 30);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("box");

        if (script.Info.Type == GunType.Machinegun || script.Info.Type == GunType.Pistol || script.Info.Type == GunType.Sniper)
        {
            EditorGUILayout.LabelField("", "Gun Settings", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.AimPosition   = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth     = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth     = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 0.01f, 15f);
            script.AimSway       = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimSwayAmount = EditorGUILayout.Slider("Aim Sway Amount", script.AimSwayAmount, 0.0f, 0.1f);
            script.AimFog        = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("box");
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.EndVertical();
            EditorGUILayout.LabelField("", "Fire Effects", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(ParticleSystem), allowSceneObjects) as UnityEngine.ParticleSystem;
            script.shell        = EditorGUILayout.ObjectField("Shell", script.shell, typeof(ParticleSystem), allowSceneObjects) as ParticleSystem;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.EndVertical();
            EditorGUILayout.LabelField("", "Gun properties", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.bulletSpeed = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce = EditorGUILayout.IntSlider("Impact Force", script.impactForce, 0, 30);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.kickBackAmount = EditorGUILayout.FloatField("Recoil", script.kickBackAmount);
            EditorGUILayout.Space();
            script.AutoReload       = EditorGUILayout.Toggle("Auto Reload", script.AutoReload);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.EndVertical();
            EditorGUILayout.LabelField("", "Audio", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.FireSound    = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.DryFireSound = EditorGUILayout.ObjectField("DryFire Sound", script.DryFireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            if (script.Info.Type == GunType.Sniper)
            {
                script.delayForSecondFireSound = EditorGUILayout.Slider("Delay Second Fire Sound", script.delayForSecondFireSound, 0.0f, 2.0f);
                script.DelaySource             = EditorGUILayout.ObjectField("Second Source", script.DelaySource, typeof(UnityEngine.AudioSource), allowSceneObjects) as UnityEngine.AudioSource;
            }
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.Info.Type == GunType.Burst)
        {
            EditorGUILayout.LabelField("", "Gun Settings", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.AimPosition   = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth     = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth     = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway       = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimSwayAmount = EditorGUILayout.Slider("Aim Sway Amount", script.AimSwayAmount, 0.0f, 0.1f);
            script.AimFog        = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.shell       = EditorGUILayout.ObjectField("Shell", script.shell, typeof(ParticleSystem), allowSceneObjects) as ParticleSystem;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(ParticleSystem), allowSceneObjects) as ParticleSystem;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", "box");
            script.roundsPerBurst  = EditorGUILayout.IntSlider("Rounds Per Burst", script.roundsPerBurst, 1, 10);
            script.lagBetweenShots = EditorGUILayout.Slider("Lag Between Shots", script.lagBetweenShots, 0.01f, 5.0f);
            script.bulletSpeed     = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce     = EditorGUILayout.IntField("Impact Force", script.impactForce);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.AutoReload       = EditorGUILayout.Toggle("Auto Reload", script.AutoReload);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.LabelField("", "Audio", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.FireSound         = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.DryFireSound      = EditorGUILayout.ObjectField("DryFire Sound", script.DryFireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.Info.Type == GunType.Shotgun)
        {
            EditorGUILayout.LabelField("", "ShotGun Settings", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.AimPosition   = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth     = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth     = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway       = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimSwayAmount = EditorGUILayout.Slider("Aim Sway Amount", script.AimSwayAmount, 0.0f, 0.1f);
            script.AimFog        = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet      = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.shell       = EditorGUILayout.ObjectField("Shell", script.shell, typeof(ParticleSystem), allowSceneObjects) as ParticleSystem;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.muzzleFlash  = EditorGUILayout.ObjectField("Muzzle Flash", script.muzzleFlash, typeof(ParticleSystem), allowSceneObjects) as ParticleSystem;
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", EditorStyles.toolbar);

            script.pelletsPerShot  = EditorGUILayout.IntSlider("Bullets Per Shots", (int)script.pelletsPerShot, 1, 10);
            script.roundsPerTracer = EditorGUILayout.IntSlider("Rounds Per Tracer", (int)script.roundsPerTracer, 1, 5);
            script.bulletSpeed     = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce     = EditorGUILayout.IntField("Impact Force", script.impactForce);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.AutoReload       = EditorGUILayout.Toggle("Auto Reload", script.AutoReload);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound               = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.DryFireSound            = EditorGUILayout.ObjectField("DryFire Sound", script.DryFireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.delayForSecondFireSound = EditorGUILayout.Slider("Delay Second Fire Sound", script.delayForSecondFireSound, 0.0f, 2.0f);
            script.DelaySource             = EditorGUILayout.ObjectField("Second Source", script.DelaySource, typeof(UnityEngine.AudioSource), allowSceneObjects) as UnityEngine.AudioSource;
            script.TakeSound               = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim       = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        if (script.Info.Type == GunType.Knife)
        {
            EditorGUILayout.LabelField("", "Knife Settings", "box");
            EditorGUILayout.BeginVertical("box");
            script.AimPosition   = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth     = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth     = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 0.01f, 15f);
            script.AimSway       = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimSwayAmount = EditorGUILayout.Slider("Aim Sway Amount", script.AimSwayAmount, 0.0f, 0.1f);
            script.AimFog        = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.bullet = EditorGUILayout.ObjectField("Bullet", script.bullet, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Fire Effects", "box");
            script.impactEffect = EditorGUILayout.ObjectField("Impact Effect", script.impactEffect, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            EditorGUILayout.LabelField("", "Gun properties", "box");
            script.bulletSpeed = EditorGUILayout.FloatField("Bullet Speed", script.bulletSpeed);
            script.impactForce = EditorGUILayout.IntSlider("Impact Force", script.impactForce, 0, 30);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.TakeSound = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;

            EditorGUILayout.EndVertical();
        }
        if (script.Info.Type == GunType.Grenade)
        {
            EditorGUILayout.LabelField("", "Grenade Settings", EditorStyles.toolbar);
            EditorGUILayout.BeginVertical("box");
            script.AimPosition   = EditorGUILayout.Vector3Field("Aim Position", script.AimPosition);
            script.useSmooth     = EditorGUILayout.Toggle("Use Smooth", script.useSmooth);
            script.AimSmooth     = EditorGUILayout.Slider("Aim Smooth", script.AimSmooth, 1.0f, 15f);
            script.AimSway       = EditorGUILayout.Slider("Aim Sway", script.AimSway, 0.0f, 10);
            script.AimSwayAmount = EditorGUILayout.Slider("Aim Sway Amount", script.AimSwayAmount, 0.0f, 0.1f);
            script.AimFog        = EditorGUILayout.Slider("Aim Fog", script.AimFog, 0.0f, 179);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
            script.grenade     = EditorGUILayout.ObjectField("Grenade", script.grenade, typeof(UnityEngine.GameObject), allowSceneObjects) as UnityEngine.GameObject;
            script.muzzlePoint = EditorGUILayout.ObjectField("Fire Point", script.muzzlePoint, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform;
            EditorGUILayout.LabelField("", "Grenade properties", EditorStyles.toolbar);
            script.DelayFire   = EditorGUILayout.FloatField("Delay Fire", script.DelayFire);
            script.bulletSpeed = EditorGUILayout.FloatField("Projectile Speed", script.bulletSpeed);
            script.impactForce = EditorGUILayout.IntField("Impact Force", script.impactForce);
            EditorGUILayout.Space();
            script.ShakeIntense   = EditorGUILayout.Slider("Shake Intense", script.ShakeIntense, 0.0f, 2.0f);
            script.kickBackAmount = EditorGUILayout.FloatField("Kick Back Amount", script.kickBackAmount);
            EditorGUILayout.Space();
            script.AutoReload       = EditorGUILayout.Toggle("Auto Reload", script.AutoReload);
            script.bulletsPerClip   = EditorGUILayout.IntField("Bullets Per Clips", script.bulletsPerClip);
            script.maxNumberOfClips = EditorGUILayout.IntField("Max Clips", script.maxNumberOfClips);
            script.numberOfClips    = EditorGUILayout.IntSlider("Clips", script.numberOfClips, 0, script.maxNumberOfClips);
            EditorGUILayout.Space();
            script.baseSpread           = EditorGUILayout.FloatField("Base Spread", script.baseSpread);
            script.maxSpread            = EditorGUILayout.FloatField("Max Spread", script.maxSpread);
            script.spreadPerSecond      = EditorGUILayout.FloatField("Spread Per Seconds", script.spreadPerSecond);
            script.decreaseSpreadPerSec = EditorGUILayout.FloatField("Decrease Spread Per Sec", script.decreaseSpreadPerSec);
            EditorGUILayout.Space();

            list.DoLayoutList();

            EditorGUILayout.LabelField("", "Audio", "box");
            EditorGUILayout.BeginVertical("box");
            script.FireSound         = EditorGUILayout.ObjectField("Fire Sound", script.FireSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.TakeSound         = EditorGUILayout.ObjectField("Take Sound", script.TakeSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            script.SoundReloadByAnim = EditorGUILayout.Toggle("Sounds Reload By Animation", script.SoundReloadByAnim);
            if (!script.SoundReloadByAnim)
            {
                script.ReloadSound  = EditorGUILayout.ObjectField("Reload Begin", script.ReloadSound, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound2 = EditorGUILayout.ObjectField("Reload Middle", script.ReloadSound2, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
                script.ReloadSound3 = EditorGUILayout.ObjectField("Reload End", script.ReloadSound3, typeof(UnityEngine.AudioClip), allowSceneObjects) as UnityEngine.AudioClip;
            }
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.EndVertical();
        serializedObject.ApplyModifiedProperties();
    }