示例#1
0
 private void StrikePlayerChoice(GameObject target, bool is_ranged, bool offhand = false)
 {
     if (!is_ranged)
     {
         EquippedMeleeWeapon.gameObject.SetActive(true);
         if (EquippedOffhand != null)
         {
             EquippedOffhand.gameObject.SetActive(true);
         }
         if (EquippedRangedWeapon != null)
         {
             EquippedRangedWeapon.gameObject.SetActive(false);
         }
         AttackInMelee.Strike(target, offhand);
     }
     else if (EquippedRangedWeapon != null)
     {
         EquippedRangedWeapon.gameObject.SetActive(true);
         if (EquippedMeleeWeapon != null)
         {
             EquippedMeleeWeapon.gameObject.SetActive(false);
         }
         if (EquippedOffhand != null)
         {
             EquippedOffhand.gameObject.SetActive(false);
         }
         AttackFromRange.Strike(target);
     }
     if (Me.Actions.Stealth.IsHiding)
     {
         Me.Actions.Stealth.StopHiding();                              // appear after the strike to ensure sneak attack damage, etc
     }
     Engaged = true;
 }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        AttackInMelee attackThePlayer = target as AttackInMelee;

        EditorGUILayout.BeginVertical();


        attackThePlayer.hasMultipleAttacks = EditorGUILayout.ToggleLeft("Has Multiple Attacks ", attackThePlayer.hasMultipleAttacks);

        if (attackThePlayer.hasMultipleAttacks)
        {
            attackThePlayer.attackCount = EditorGUILayout.IntField("Number of attacks :", attackThePlayer.attackCount);
        }

        if (GUILayout.Button("Save Asset"))
        {
            EditorUtility.SetDirty(attackThePlayer);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }


        EditorGUILayout.EndVertical();
    }
示例#3
0
    public void StrikeEnemy(GameObject target, bool is_ranged, bool offhand = false, bool player_target = false)
    {
        if (target == null || (EquippedMeleeWeapon == null && EquippedRangedWeapon == null))
        {
            return;
        }

        if (player_target)
        {
            StrikePlayerChoice(target, is_ranged, offhand);
            return;
        }

        if (!is_ranged)
        {
            EquippedMeleeWeapon.gameObject.SetActive(true);
            if (EquippedOffhand != null)
            {
                EquippedOffhand.gameObject.SetActive(true);
            }
            if (EquippedRangedWeapon != null)
            {
                EquippedRangedWeapon.gameObject.SetActive(false);
            }
            if (IsWithinMeleeRange(target.transform))
            {
                AttackInMelee.Strike(target, offhand);
            }
        }
        else
        {
            EquippedRangedWeapon.gameObject.SetActive(true);
            if (EquippedMeleeWeapon != null)
            {
                EquippedMeleeWeapon.gameObject.SetActive(false);
            }
            if (EquippedOffhand != null)
            {
                EquippedOffhand.gameObject.SetActive(false);
            }
            if (IsWithinAttackRange(target.transform))
            {
                AttackFromRange.Strike(target);
            }
        }
        if (Me.Actions.Stealth.IsHiding)
        {
            Me.Actions.Stealth.StopHiding();                              // appear after the strike to ensure sneak attack damage, etc
        }
        Engaged = true;
    }