因此,我一直在尝试创建一个mod,我遇到了一个问题,试图要求多个技能集,或者更确切地说,限制多个技能集。
我试图做的是将其锁定,这样玩家一次只能访问一个技能树。我的工作是下面的,但这并不能阻止他们在另一棵树上学习技能。
namespace Test.run.TechTree
{
using System;
using System.Runtime.Serialization;
using Test.Gameplay.Components;
using Test.Gameplay.DynamicValues;
using Test.Gameplay.Items;
using Test.Gameplay.Players;
using Test.Gameplay.Property;
using Test.Gameplay.Skills;
using Test.Gameplay.Systems.TextLinks;
using Test.Shared.Services;
using Test.Shared.Utils;
using Gameplay.Systems.Tooltip;
[DataContract]
[RequiresSkill(typeof(FireSkill), 0)]
public partial class ShootingSkill : Skill
{
public override string FriendlyName { get { return "Shooting"; } }
public override string Description { get { return "This is how you shoot"; } }
public static int[] SkillPointCost = { 1, 2, 2, 3, 3 };
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
public override int MaxLevel { get { return 4; } }
}
}这允许他们学习并将点数放入此技能树中,这很棒,但我想限制它,以便如果他们已经在另一个技能树中学习技能,则不能将技能放入此技能树中。最后,我想要说的是,如果你没有在另一个技能中投入点数,或者直到你在另一个技能中至少有50分,你就可以使用这项技能。
在这个例子中,玩家想要开始将点数放入射击技能树的Fireskill中,但我想说的是,如果他们在附件技能树的Gearskill部分中有1到49点,我不希望他们能够使用它,直到他们没有在Gearskill中投入任何东西或至少50点。我承认我是C#的新手,还在学习更多关于属性的知识,但是我如何才能将下面的概念应用到工作中呢?任何帮助都将不胜感激。
namespace Test.run.TechTree
{
using System;
using System.Runtime.Serialization;
using Test.Gameplay.Components;
using Test.Gameplay.DynamicValues;
using Test.Gameplay.Items;
using Test.Gameplay.Players;
using Test.Gameplay.Property;
using Test.Gameplay.Skills;
using Test.Gameplay.Systems.TextLinks;
using Test.Shared.Services;
using Test.Shared.Utils;
using Gameplay.Systems.Tooltip;
[DataContract]
[RequiresSkill(typeof(FireSkill), 0), RequiresSkill(typeof(GearSkill), >1 or <50]
public partial class ShootingSkill : Skill
{
public override string FriendlyName { get { return "Shooting"; } }
public override string Description { get { return "This is how you shoot"; } }
public static int[] SkillPointCost = { 1, 2, 2, 3, 3 };
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
public override int MaxLevel { get { return 4; } }
}
}发布于 2017-05-14 03:58:06
您需要为RequiresSkill属性设置AllowMultiple = true。
[AttributeUsage(AttributeTargets.{whatever}, AllowMultiple = true)]
public class RequiresSkill : Attribute
{
} https://stackoverflow.com/questions/43956982
复制相似问题