当前位置: 首页>>代码示例>>C#>>正文


C# Equipment.GetParam方法代码示例

本文整理汇总了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;
                    }
                }
//.........这里部分代码省略.........
开发者ID:JoeOsborn,项目名称:SRPGCK,代码行数:101,代码来源:Formulae.cs


注:本文中的Equipment.GetParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。