Exemple #1
0
        protected void SetOnEnable()
        {
            M = (MWeapon)target;

            Sounds         = serializedObject.FindProperty("Sounds");
            WeaponSound    = serializedObject.FindProperty("WeaponSound");
            AffectStat     = serializedObject.FindProperty("AffectStat");
            weaponType     = serializedObject.FindProperty("weaponType");
            weaponID       = serializedObject.FindProperty("weaponID");
            rightHand      = serializedObject.FindProperty("rightHand");
            minDamage      = serializedObject.FindProperty("minDamage");
            maxDamage      = serializedObject.FindProperty("maxDamage");
            minForce       = serializedObject.FindProperty("minForce");
            maxForce       = serializedObject.FindProperty("maxForce");
            holder         = serializedObject.FindProperty("holder");
            rotationOffset = serializedObject.FindProperty("rotationOffset");
            positionOffset = serializedObject.FindProperty("positionOffset");
        }
Exemple #2
0
        //static Vector3 InvectorOffsetPos_R = new Vector3(2,7.8f,3.3f);
        //static Vector3 InvectorOffsetRot_R = new Vector3(-1.184f, -90, 80.263f);

        //static Vector3 InvectorOffsetPos_L = new Vector3(-2.4f, 9.5f, 4.5f);
        //static Vector3 InvectorOffsetRot_L = new Vector3(0, -92.178f, -85.028f);

        protected void WeaponProperties()
        {
            weapon = (MWeapon)target;

            if (weapon.weaponID == 0)
            {
                weapon.weaponID = Random.Range(10000, 99999);
            }
            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            {
                EditorGUILayout.LabelField("Weapon ID", EditorStyles.label, (GUILayout.MinWidth(1)));
                weapon.weaponID = EditorGUILayout.IntField(new GUIContent("", "WeaponID"), weapon.weaponID, GUILayout.MinWidth(1));
                if (GUILayout.Button("Generate", EditorStyles.miniButton, GUILayout.MinWidth(55)))
                {
                    weapon.weaponID = Random.Range(10000, 99999);
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Damage Range", GUILayout.MaxWidth(116));
                weapon.minDamage = EditorGUILayout.FloatField(new GUIContent("", "Minimun Damage"), weapon.minDamage, GUILayout.MinWidth(1));
                weapon.maxDamage = EditorGUILayout.FloatField(new GUIContent("", "Maximun Damage"), weapon.maxDamage, GUILayout.MinWidth(1));

                if (weapon.maxDamage < weapon.minDamage)
                {
                    weapon.maxDamage = weapon.minDamage;
                }


                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Force Range", GUILayout.MaxWidth(116));
                weapon.minForce = EditorGUILayout.FloatField(new GUIContent("", "Minimun Force"), weapon.minForce, GUILayout.MinWidth(1));
                weapon.maxForce = EditorGUILayout.FloatField(new GUIContent("", "Maximun Force"), weapon.maxForce, GUILayout.MinWidth(1));

                if (weapon.maxForce < weapon.minForce)
                {
                    weapon.maxForce = weapon.minForce;
                }


                EditorGUILayout.EndHorizontal();

                weapon.rightHand = EditorGUILayout.Toggle(new GUIContent(weapon.rightHand ? "Right Hand" : "Left Hand", "Which Hand the weapon uses"), weapon.rightHand);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                weapon.holder = (WeaponHolder)EditorGUILayout.EnumPopup(new GUIContent("Holder", "The Side where the weapon Draw/Store from"), weapon.holder, GUILayout.MinWidth(10));
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUI.indentLevel++;
                offsets = EditorGUILayout.Foldout(offsets, "Offsets");
                EditorGUI.indentLevel--;
                if (offsets)
                {
                    weapon.positionOffset = EditorGUILayout.Vector3Field(new GUIContent("Position"), weapon.positionOffset);
                    weapon.rotationOffset = EditorGUILayout.Vector3Field(new GUIContent("Rotation"), weapon.rotationOffset);
                }
            }
            EditorGUILayout.EndVertical();
        }
        //static Vector3 InvectorOffsetPos_R = new Vector3(2,7.8f,3.3f);
        //static Vector3 InvectorOffsetRot_R = new Vector3(-1.184f, -90, 80.263f);

        //static Vector3 InvectorOffsetPos_L = new Vector3(-2.4f, 9.5f, 4.5f);
        //static Vector3 InvectorOffsetRot_L = new Vector3(0, -92.178f, -85.028f);

        protected void WeaponProperties()
        {
            weapon = (MWeapon)target;

            if (weapon.weaponID == 0)
            {
                weapon.weaponID = Random.Range(10000, 99999);
            }

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("active"));
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            {
                EditorGUILayout.LabelField("Weapon ID", EditorStyles.label, (GUILayout.MinWidth(1)));
                weapon.weaponID = EditorGUILayout.IntField(new GUIContent("", "WeaponID"), weapon.weaponID, GUILayout.MinWidth(1));
                if (GUILayout.Button("Generate", EditorStyles.miniButton, GUILayout.MinWidth(55)))
                {
                    weapon.weaponID = Random.Range(10000, 99999);
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Damage Range", GUILayout.MaxWidth(116));

                var minDamage = serializedObject.FindProperty("minDamage");
                var maxDamage = serializedObject.FindProperty("maxDamage");
                minDamage.floatValue = EditorGUILayout.FloatField(new GUIContent("", "Minimun Damage"), minDamage.floatValue, GUILayout.MinWidth(1));
                maxDamage.floatValue = EditorGUILayout.FloatField(new GUIContent("", "Maximun Damage"), maxDamage.floatValue, GUILayout.MinWidth(1));

                if (maxDamage.floatValue < minDamage.floatValue)
                {
                    maxDamage.floatValue = minDamage.floatValue;
                    serializedObject.ApplyModifiedProperties();
                }


                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Force Range", GUILayout.MaxWidth(116));

                var minForce = serializedObject.FindProperty("minForce");
                var maxForce = serializedObject.FindProperty("maxForce");

                minForce.floatValue = EditorGUILayout.FloatField(new GUIContent("", "Minimun Force"), minForce.floatValue, GUILayout.MinWidth(1));
                maxForce.floatValue = EditorGUILayout.FloatField(new GUIContent("", "Maximun Force"), maxForce.floatValue, GUILayout.MinWidth(1));

                if (maxForce.floatValue < minForce.floatValue)
                {
                    maxForce.floatValue = minForce.floatValue;
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUILayout.EndHorizontal();

                var rightHand = serializedObject.FindProperty("rightHand");
                rightHand.boolValue = EditorGUILayout.Toggle(new GUIContent(rightHand.boolValue ? "Right Hand" : "Left Hand", "Which Hand the weapon uses"), rightHand.boolValue);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                weapon.holder = (WeaponHolder)EditorGUILayout.EnumPopup(new GUIContent("Holder", "The Side where the weapon Draw/Store from"), weapon.holder, GUILayout.MinWidth(10));
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUI.indentLevel++;
                offsets = EditorGUILayout.Foldout(offsets, "Offsets");
                EditorGUI.indentLevel--;
                if (offsets)
                {
                    weapon.positionOffset = EditorGUILayout.Vector3Field(new GUIContent("Position"), weapon.positionOffset);
                    weapon.rotationOffset = EditorGUILayout.Vector3Field(new GUIContent("Rotation"), weapon.rotationOffset);
                }
            }
            EditorGUILayout.EndVertical();
        }