本文整理汇总了C#中Equipment.GetParam方法的典型用法代码示例。如果您正苦于以下问题:C# Equipment.GetParam方法的具体用法?C# Equipment.GetParam怎么用?C# Equipment.GetParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Equipment
的用法示例。
在下文中一共展示了Equipment.GetParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lookup
public float Lookup(
string fname, LookupType type,
SkillDef scontext=null,
Character ccontext=null,
Character tcontext=null,
Equipment econtext=null,
Item icontext=null,
Formula f=null
)
{
switch(type) {
case LookupType.Auto: {
float ret =
(icontext != null ? icontext.GetParam(fname) :
(econtext != null ? econtext.GetParam(fname) :
(scontext != null ? scontext.GetParam(fname) :
(ccontext != null ? ccontext.GetStat(fname) :
(tcontext != null ? tcontext.GetStat(fname) :
(HasFormula(fname) ? LookupFormula(fname).GetValue(this, scontext, ccontext, tcontext, econtext, icontext) : float.NaN))))));
if(float.IsNaN(ret)) {
Debug.LogError("auto lookup failed for "+fname);
}
return ret;
}
case LookupType.SkillParam:
return scontext.GetParam(fname);
case LookupType.ItemParam: {
if(icontext == null && scontext != null) {
icontext = scontext.InvolvedItem;
}
if(icontext == null && econtext != null) {
icontext = econtext.baseItem;
}
return icontext.GetParam(fname, scontext);
}
case LookupType.ReactedItemParam: {
icontext = scontext.currentReactedSkill.InvolvedItem;
return icontext.GetParam(fname, scontext);
}
case LookupType.ActorStat:
if(scontext != null) { return scontext.character.GetStat(fname); }
if(econtext != null) { return econtext.wielder.GetStat(fname); }
if(ccontext != null) { return ccontext.GetStat(fname); }
Debug.LogError("Cannot find actor stat "+fname);
return float.NaN;
case LookupType.ActorMountStat: {
Character m = null;
if(scontext != null) { m = scontext.character.mountedCharacter; }
if(econtext != null) { m = econtext.wielder.mountedCharacter; }
if(ccontext != null) { m = ccontext.mountedCharacter; }
// Debug.Log("lookup "+fname+" on mount "+m+" ? "+(m != null ? m.GetStat(fname) : 0));
if(m != null) {
return m.GetStat(fname);
}
Debug.LogError("Cannot find actor mount stat "+fname);
return float.NaN;
}
case LookupType.ActorMounterStat: {
Character m = null;
if(scontext != null) { m = scontext.character.mountingCharacter; }
if(econtext != null) { m = econtext.wielder.mountingCharacter; }
if(ccontext != null) { m = ccontext.mountingCharacter; }
if(m != null) {
return m.GetStat(fname);
}
Debug.LogError("Cannot find actor mounter stat "+fname);
return float.NaN;
}
case LookupType.ActorEquipmentParam:
if(scontext != null) {
ccontext = scontext.character;
} else if(ccontext == null && econtext != null) {
if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
return econtext.GetParam(fname);
} else {
ccontext = econtext.wielder;
}
}
return LookupEquipmentParamOn(fname, type, ccontext, f, scontext);
case LookupType.ActorMountEquipmentParam:
if(scontext != null) {
ccontext = scontext.character.mountedCharacter;
} else if(ccontext == null && econtext != null) {
if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
return econtext.GetParam(fname);
} else {
ccontext = econtext.wielder.mountedCharacter;
}
}
return LookupEquipmentParamOn(fname, type, ccontext, f, scontext);
case LookupType.ActorMounterEquipmentParam:
if(scontext != null) {
ccontext = scontext.character.mountingCharacter;
} else if(ccontext == null && econtext != null) {
if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
return econtext.GetParam(fname);
} else {
ccontext = econtext.wielder.mountingCharacter;
}
}
//.........这里部分代码省略.........