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


C# Character.GetStat方法代码示例

本文整理汇总了C#中Character.GetStat方法的典型用法代码示例。如果您正苦于以下问题:C# Character.GetStat方法的具体用法?C# Character.GetStat怎么用?C# Character.GetStat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character的用法示例。


在下文中一共展示了Character.GetStat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CharacterMoved

    public override void CharacterMoved(
		Character c,
		Vector3 src,
		Vector3 dest,
		PathNode endOfPath
	)
    {
        base.CharacterMoved(c, src, dest, endOfPath);
        if(c != activeCharacter) { return; }
        //reduce c's CT by per-tile movement cost (0)
        activeCharacterHasMoved = true;
        float cost =
            ((perTileCTCostStat != null ?
                c.GetStat(perTileCTCostStat, defaultPerTileCTCost) :
                defaultPerTileCTCost)*endOfPath.xyDistanceFromStart) +
            (perMoveCTCostStat != null ?
                c.GetStat(perMoveCTCostStat, defaultPerMoveCTCost) :
                defaultPerMoveCTCost);
        if(coalesceCTDecrements) {
            pendingCTDecrement += cost;
        } else {
            c.AdjustBaseStat(ctStat, -cost);
        }
    }
开发者ID:JoeOsborn,项目名称:SRPGCK,代码行数:24,代码来源:CTScheduler.cs

示例2: SetCharacter

  public void SetCharacter(Character newCharacter) {
    character = newCharacter;

    image.sprite = character.gameObject.GetComponent<SpriteRenderer>().sprite;
    textName.text = character.name;

    sliderHP.maxValue = character.GetStat("maxHealth");
    sliderHP.value = character.GetStat("health");
    textHP.text = character.GetStat("health") + "/" + character.GetStat("maxHealth");

    textMP.text = "0/100";
    sliderMP.maxValue = 100;
    sliderMP.value = 0;

    textLevel.text = "Level:" + character.level.ToString();
    textLevelToNext.text = character.experience.ToString() + "/" + character.experienceToNextLevel.ToString();
    sliderLevel.maxValue = character.experienceToNextLevel;
    sliderLevel.value = 0;

    stat.SetStats(character.GetStat("attack"), 0, character.GetStat("defense"), 0, character.GetStat("speed"), 0, character.GetStat("range"), 0);
  }
开发者ID:birkoss,项目名称:roguelike,代码行数:21,代码来源:PopupCharacterInfo.cs

示例3: Deactivate

 public override void Deactivate(Character c, object ctx=null)
 {
     base.Deactivate(c, ctx);
     //reduce c's CT by base turn cost (30)
     float cost = perActivationCTCostStat != null ?
         c.GetStat(perActivationCTCostStat, defaultPerActivationCTCost) :
         defaultPerActivationCTCost;
     if(coalesceCTDecrements) {
         pendingCTDecrement += cost;
         c.AdjustBaseStat(ctStat, -pendingCTDecrement);
         pendingCTDecrement = 0;
     } else {
         c.AdjustBaseStat(ctStat, -cost);
     }
     activeCharacterHasMoved = false;
     activeCharacterHasActed = false;
 }
开发者ID:JoeOsborn,项目名称:SRPGCK,代码行数:17,代码来源:CTScheduler.cs

示例4: 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


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