Exemple #1
0
        /// <summary>
        /// Set active Single Part to attack
        /// </summary>
        /// <param name="bodyPart"></param>
        /// <param name="type"></param>
        /// <param name="active"></param>
        /// <param name="damageMultiplier"></param>
        public virtual void SetActiveAttack(string bodyPart, vAttackType type, bool active = true, int damageMultiplier = 0, int recoilID = 0, int reactionID = 0, bool ignoreDefense = false, bool activeRagdoll = false, string attackName = "")
        {
            this.damageMultiplier = damageMultiplier;
            currentRecoilID       = recoilID;
            currentReactionID     = reactionID;
            this.ignoreDefense    = ignoreDefense;
            this.activeRagdoll    = activeRagdoll;
            this.attackName       = attackName;

            if (type == vAttackType.Unarmed)
            {
                /// find attackObject by bodyPart
                var attackObject = Members.Find(member => member.bodyPart == bodyPart);
                if (attackObject != null)
                {
                    attackObject.SetActiveDamage(active);
                }
            }
            else
            {   ///if AttackType == MeleeWeapon
                ///this work just for Right and Left Lower Arm
                if (bodyPart == "RightLowerArm" && rightWeapon != null)
                {
                    rightWeapon.meleeManager = this;
                    rightWeapon.SetActiveDamage(active);
                }
                else if (bodyPart == "LeftLowerArm" && leftWeapon != null)
                {
                    leftWeapon.meleeManager = this;
                    leftWeapon.SetActiveDamage(active);
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Set active Multiple Parts to attack
 /// </summary>
 /// <param name="bodyParts"></param>
 /// <param name="type"></param>
 /// <param name="active"></param>
 /// <param name="damageMultiplier"></param>
 public virtual void SetActiveAttack(List <string> bodyParts, vAttackType type, bool active = true, int damageMultiplier = 0, int recoilID = 0, int reactionID = 0, bool ignoreDefense = false, bool activeRagdoll = false, string attackName = "")
 {
     for (int i = 0; i < bodyParts.Count; i++)
     {
         var bodyPart = bodyParts[i];
         SetActiveAttack(bodyPart, type, active, damageMultiplier, recoilID, reactionID, ignoreDefense, activeRagdoll, attackName);
     }
 }
Exemple #3
0
    /// <summary>
    /// Set active Multiple Parts to attack
    /// </summary>
    /// <param name="bodyParts"></param>
    /// <param name="type"></param>
    /// <param name="active"></param>
    /// <param name="damageMultiplier"></param>
    public virtual void SetActiveAttack(vAttackType type, bool active = true, int damageMultiplier = 0, string attackName = "")
    {
        this.damageMultiplier = damageMultiplier;
        this.attackName       = attackName;

        if (type == vAttackType.Unarmed)
        {
            aiAttackObject.SetActiveDamage(active);
        }
    }
 void OnEnable()
 {
     try
     {
         attackControl     = (vMeleeAttackControl)target;
         currentAttackType = attackControl.meleeAttackType;
         skin = Resources.Load("skin") as GUISkin;
     }
     catch { }
     indexSelected = -1;
     isHuman       = true;
 }
Exemple #5
0
 void OnEnable()
 {
     try
     {
         attackControl     = (vMeleeAttackControl)target;
         currentAttackType = attackControl.meleeAttackType;
         skin = Resources.Load("skin") as GUISkin;
     }
     catch { }
     indexSelected = -1;
     isHuman       = true;
     m_Logo        = (Texture2D)Resources.Load("icon_v2", typeof(Texture2D));
 }
Exemple #6
0
        public override void OnInspectorGUI()
        {
            defaultSkin = GUI.skin;
            if (skin)
            {
                GUI.skin = skin;
            }
            GUILayout.BeginVertical("Melee Attack Control", "window");
            GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
            base.OnInspectorGUI();
            GUILayout.BeginVertical();

            GUILayout.BeginVertical("box");
            GUILayout.BeginHorizontal();
            GUILayout.Box("nº", GUILayout.Width(40));
            GUILayout.Box("BodyPart", GUILayout.ExpandWidth(true));
            GUILayout.Box("", GUILayout.Width(20));
            GUILayout.EndHorizontal();
            for (int i = 0; i < attackControl.bodyParts.Count; i++)
            {
                GUILayout.BeginHorizontal();
                GUIStyle labelCenter = EditorStyles.miniLabel;
                labelCenter.alignment = TextAnchor.MiddleCenter;
                GUILayout.Box(i.ToString("00"), labelCenter, GUILayout.Width(40));
                Color color = GUI.color;
                GUI.color = indexSelected == i ? new Color(1, 1, 0, 1) : color;
                if (GUILayout.Button(attackControl.bodyParts[i], EditorStyles.miniButton))
                {
                    if (indexSelected == i)
                    {
                        inEditBodyPart = false;
                        indexSelected  = -1;
                        oldBodyPart    = "";
                    }
                    else
                    {
                        indexSelected  = i;
                        inEditBodyPart = true;
                        oldBodyPart    = attackControl.bodyParts[indexSelected];
                        try
                        {
                            oldBodyPart = Enum.Parse(typeof(vHumanBones), oldBodyPart).ToString();
                            isHuman     = true;
                        }
                        catch { isHuman = false; }
                    }
                }
                GUI.color = color;
                if (attackControl.bodyParts.Count > 1 && !inEditBodyPart && GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20)))
                {
                    attackControl.bodyParts.RemoveAt(i);
                    GUILayout.EndHorizontal();
                    break;
                }
                else if (attackControl.bodyParts.Count == 1 || inEditBodyPart)
                {
                    GUILayout.Label("", GUILayout.Width(20));
                }

                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndVertical();
            if (inEditBodyPart)
            {
                EditBodyPart();
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Add New Body Part", EditorStyles.miniButton))
            {
                inAddBodyPart   = true;
                isHuman         = true;
                currentBodyPart = "RightLowerArm";
            }
            if (currentAttackType != attackControl.meleeAttackType)
            {
                currentAttackType = attackControl.meleeAttackType;
                if (currentAttackType == vAttackType.MeleeWeapon)
                {
                    var noMeleeWeapon = attackControl.bodyParts.FindAll(bodyPart => bodyPart != "LeftLowerArm" || bodyPart != "RightLowerArm");
                    if (noMeleeWeapon.Count > 0)
                    {
                        attackControl.bodyParts.RemoveAll(bodyPart => !(bodyPart == "LeftLowerArm" || bodyPart == "RightLowerArm"));
                    }
                }
            }

            if (inAddBodyPart)
            {
                AddBodyPart();
            }

            GUILayout.EndVertical();
            GUI.skin = defaultSkin;
        }
Exemple #7
0
        public override void OnInspectorGUI()
        {
            defaultSkin = GUI.skin;
            if (skin)
            {
                GUI.skin = skin;
            }
            GUILayout.BeginVertical("Melee Attack Control", "window");
            GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
            EditorGUILayout.HelpBox("Make sure that the <b>Exit Time</b> of this state to the next one in your Combo is <b>lower</b> then the Exit Time to the Exit state, otherwise it will always exit first and never play the next animation.\n\n" +
                                    "For Example if your Exit Time to the Exit State is 0.7 then your transition to the next state must be 0.6 or lower.\n\n" +
                                    "The same applies to the <b>End Damage</b> and <b> Allow Movement At</b>", MessageType.Info);
            base.OnInspectorGUI();
            GUILayout.BeginVertical();

            GUILayout.BeginVertical("box");
            GUILayout.BeginHorizontal();
            GUILayout.Box("nº", GUILayout.Width(40));
            GUILayout.Box("BodyPart", GUILayout.ExpandWidth(true));
            GUILayout.Box("", GUILayout.Width(20));
            GUILayout.EndHorizontal();

            for (int i = 0; i < attackControl.bodyParts.Count; i++)
            {
                GUILayout.BeginHorizontal();
                GUIStyle labelCenter = EditorStyles.miniLabel;
                labelCenter.alignment = TextAnchor.MiddleCenter;
                GUILayout.Box(i.ToString("00"), labelCenter, GUILayout.Width(40));
                Color color = GUI.color;
                GUI.color = indexSelected == i ? new Color(1, 1, 0, 1) : color;
                if (GUILayout.Button(attackControl.bodyParts[i], EditorStyles.miniButton))
                {
                    if (indexSelected == i)
                    {
                        inEditBodyPart = false;
                        indexSelected  = -1;
                        oldBodyPart    = "";
                    }
                    else
                    {
                        indexSelected  = i;
                        inEditBodyPart = true;
                        oldBodyPart    = attackControl.bodyParts[indexSelected];
                        try
                        {
                            oldBodyPart = Enum.Parse(typeof(vHumanBones), oldBodyPart).ToString();
                            isHuman     = true;
                        }
                        catch { isHuman = false; }
                    }
                }
                GUI.color = color;
                if (attackControl.bodyParts.Count > 1 && !inEditBodyPart && GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20)))
                {
                    attackControl.bodyParts.RemoveAt(i);
                    GUILayout.EndHorizontal();
                    break;
                }
                else if (attackControl.bodyParts.Count == 1 || inEditBodyPart)
                {
                    GUILayout.Label("", GUILayout.Width(20));
                }

                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndVertical();
            if (inEditBodyPart)
            {
                EditBodyPart();
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Add New Body Part", EditorStyles.miniButton))
            {
                inAddBodyPart   = true;
                isHuman         = true;
                currentBodyPart = "RightLowerArm";
            }
            if (currentAttackType != attackControl.meleeAttackType)
            {
                currentAttackType = attackControl.meleeAttackType;
                if (currentAttackType == vAttackType.MeleeWeapon)
                {
                    var noMeleeWeapon = attackControl.bodyParts.FindAll(bodyPart => bodyPart != "LeftLowerArm" || bodyPart != "RightLowerArm");
                    if (noMeleeWeapon.Count > 0)
                    {
                        attackControl.bodyParts.RemoveAll(bodyPart => !(bodyPart == "LeftLowerArm" || bodyPart == "RightLowerArm"));
                    }
                }
            }

            if (inAddBodyPart)
            {
                AddBodyPart();
            }

            GUILayout.EndVertical();
            GUI.skin = defaultSkin;
        }