本文整理汇总了C#中Stat类的典型用法代码示例。如果您正苦于以下问题:C# Stat类的具体用法?C# Stat怎么用?C# Stat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Stat类属于命名空间,在下文中一共展示了Stat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetType
public void SetType(itemType type)
{
this.type = type;
switch (type)
{
case itemType.계란:
variation = new Stat(1, 2, 3);
names = "계란";
message = "무슨 계란인지 모르겠다.";
consumable = 1;
break;
case itemType.아이템2:
variation = new Stat(3, 2, 1);
names = "아이템2";
message = "아이템 2라고 한다.";
consumable = 2;
break;
case itemType.아이템3:
variation = new Stat(3, 3, 3);
names = "아이템3";
message = "아이템 3이라고 한다.";
consumable = 3;
break;
}
gameObject.GetComponent<SpriteRenderer>().sprite = graphic[(int)type];
}
示例2: OnGetPathStatus
// protected override Errno OnGetFileAttributes (string path, ref Stat stbuf)
protected override Errno OnGetPathStatus(string path, out Stat stbuf)
{
int sep = 0;
foreach (char c in path)
{
if (c == '/')
sep++;
}
stbuf = new Stat ();
if (sep < 3)
{
stbuf.st_mode = FilePermissions.S_IFDIR | NativeConvert.FromOctalPermissionString ("0755");
stbuf.st_nlink = 1;
}
else
{
stbuf.st_mode = FilePermissions.S_IFREG | NativeConvert.FromOctalPermissionString ("0444");
stbuf.st_nlink = 1;
}
stbuf.st_size = 0;
return 0;
}
示例3: Check_For_Wrong_Stats
public void Check_For_Wrong_Stats(ref Equipment_Foundation Weapon_Editor, Stat Select_Stat)
{
if (Weapon_Editor.Get_Stat(Select_Stat) != 0)
{
EditorGUILayout.HelpBox(Select_Stat.ToString() + " is not equal to zero, if this is okay contact me",MessageType.Warning);
}
}
示例4: OnGetPathStatus
protected override Errno OnGetPathStatus(string path, out Stat stbuf)
{
VFileInfo info;
data.GetFileInformation (path, out info);
// return Errno.ENOENT;
stbuf = new Stat ();
stbuf.st_mode = info.IsDirectory () ? FilePermissions.S_IFDIR : FilePermissions.S_IFREG;
stbuf.st_atime = info.LastAccessTime.ToUnix ();
stbuf.st_ctime = info.CreationTime.ToUnix ();
stbuf.st_mtime = info.LastWriteTime.ToUnix ();
stbuf.st_mtime_nsec = info.LastWriteTime.Nanoseconds();
stbuf.st_size = info.IsDirectory () ? 0 : info.Length;
stbuf.st_uid = Syscall.getuid ();
stbuf.st_gid = Syscall.getgid ();
switch (path) {
case "/":
stbuf.st_mode |= NativeConvert.FromOctalPermissionString ("0755");
stbuf.st_nlink = 2;
break;
default:
stbuf.st_mode |= NativeConvert.FromOctalPermissionString ("0444");
stbuf.st_nlink = 1;
break;
}
return 0;
}
示例5: CStats
public CStats(int mStrength, int mEndurance, int mAglity, int mSpeed)
{
Strength = new Stat(mStrength);
Endurance = new Stat(mEndurance);
Agility = new Stat(mAglity);
Speed = new Stat(mSpeed);
}
示例6: Start
public override void Start()
{
base.Start();
Strenght = new Stat("Strenght", 12, 1);
Agility = new Stat("Agility", 10, 1);
Intelligence = new Stat("Intelligence", 10, 1);
}
示例7: OnGetPathStatus
protected override Errno OnGetPathStatus(string path, out Stat stat)
{
logger.DebugFormat("OnGetPathStatus: {0}", path);
PathStatusDto status;
stat = new Stat();
try {
status = _fileService.GetPathStatus(path);
if (status.PathType == PathStatusDto.PathTypeEnum.Directory) {
stat.st_mode = FilePermissions.S_IFDIR |
// Readonly directory
NativeConvert.FromOctalPermissionString("0555");
stat.st_nlink = 2;
} else if (status.PathType == PathStatusDto.PathTypeEnum.File) {
stat.st_mode = FilePermissions.S_IFREG |
// Readonly file.
NativeConvert.FromOctalPermissionString("0444");
stat.st_nlink = 2;
stat.st_size = status.FileSize;
}
return 0;
} catch (FileNotFoundInServiceException) {
logger.DebugFormat("File not found in service.");
return Errno.ENOENT;
} catch (WebException ex) {
logger.ErrorFormat("Caught WebException: {0} : {1}", ex.Status, ex);
return Errno.ENONET;
} catch (Exception ex) {
logger.ErrorFormat("Exception caught while interacting with File Service : {0}", ex);
// TODO: Other error more appropriate?
return Errno.ENONET;
}
}
示例8: ToBuff
public static Buff ToBuff(Stat stat)
{
var members = EnumTool.GetNames(stat.KeyType);
Dictionary<Enum, float> values = new Dictionary<Enum, float>();
for (int i = 1; true; i++)
{
string form1 = string.Format("Stat{0}Type", i);
string form2 = string.Format("Stat{0}Value", i);
if (members.Contains(form1) && members.Contains(form2))
{
Enum statType = stat.GetRawValue(EnumTool.Parse(stat.KeyType.Name, form1) as Enum) as Enum;
float value = stat.Get(EnumTool.Parse(stat.KeyType.Name, form2) as Enum);
if (statType.ToString() != "None")
{
values.Add(statType, value);
}
}
else
{
break;
}
}
string name = stat.KeyType.ToString() + stat.Get(EnumTool.Parse(stat.KeyType, "ID") as Enum);
float duration = float.MaxValue;
return new Buff(name, duration, values);
}
示例9: Start
// Use this for initialization
void Start()
{
nav = GetComponent<NavMeshAgent> ();
anim = GetComponent<Animator>();
nav.speed = 12;
stats = GetComponent<Stat> ();
}
示例10: GetModifier
public double GetModifier(Stat s)
{
if (Bonus == Penalty) return 1;
if (s == Bonus) return 1.1;
if (s == Penalty) return 0.9;
return 1;
}
示例11: CreateAndModifyHealthWithRescaleStat
public void CreateAndModifyHealthWithRescaleStat()
{
string name = "Strenght";
float value = 20.0f;
float firstValue = 0.0f;
float secondValue = 0.0f;
float firstPercentage = 0.0f;
float secondPercentage = 0.0f;
Stat stat = new Stat(name, value);
//
string hName = "Health";
DerivativeStat hp = new DerivativeStat(stat, StatisticConstants.STRENGHT_TO_HEALTH_SCALE);
hp.ModifyValue(-100.0f);
firstValue = hp.CurrentValue;
firstPercentage = hp.Percentage;
stat.BaseValue -= value/2;
secondValue = hp.CurrentValue;
secondPercentage = hp.Percentage;
//
Assert.IsTrue(firstValue > secondValue);
Assert.IsTrue(firstPercentage == secondPercentage);
}
示例12: Characteristic
public Characteristic(Stat type, int value, int bonus)
{
this.type = type;
this.value = value;
this.bonus = bonus;
realvalue = this.value + bonus;
}
示例13: ApplyScaleAndCritical
static string ApplyScaleAndCritical(string pattern, Stat stat, BlockType type, float effectFactor, int criticalBuffId)
{
float ciriticalFactor = 0;
if (stat != null)
{
if (type == BlockType.Attack1 || type == BlockType.Attack2)
{
bool isCritical = RandomTool.IsIn(stat.Get(HeroStatType.criticalHitChance));
if (isCritical)
{
int parenOpen;
int parenclose;
SearchParenIndexs(pattern, "PhysicalAttack", out parenOpen, out parenclose);
pattern = pattern.Insert(parenclose, "; param=critical");
if (criticalBuffId > 0)
{
pattern = string.Format("Sequence({0}; Action(Contact; Buff; {1}) )", pattern, criticalBuffId);
}
ciriticalFactor = stat.Get(HeroStatType.criticalHitDamageFactor);
}
}
}
return string.Format(pattern, 1 + effectFactor + ciriticalFactor);
}
示例14: CalcStats
public static void CalcStats(string inputNaj, string outputName)
{
var fsa = new FsaNajka(File.OpenRead(inputNaj));
var stats = new Dictionary<char, Stat>();
fsa.IterateAllRaw(sb =>
{
var parts = sb.ToString().Split(':');
if (parts.Length != 3) return;
var s = parts[2];
Stat stat;
if (!stats.TryGetValue(s[1], out stat))
{
stat = new Stat();
stats[s[1]] = stat;
}
for (var i = 0; i < s.Length - 1; i += 2)
{
stat.Inc(s.Substring(i, 2), parts[0]);
}
});
using (var o=File.CreateText(outputName))
foreach (var stat in stats.OrderBy(p=>p.Key))
{
o.WriteLine("Kind "+stat.Key);
o.WriteLine(stat.Value);
}
}
示例15: InGameUser
public InGameUser(StageEntity2 stageEntity, Status.Handle onGoldChanged, TimedConsumableCommandSet.Handle onChargedAttack)
{
this.stat = new Stat<PlayerStatType>(StatGenerator.ExportData<PlayerStatType>(stageEntity, new StatConstants()));
this.status = new Status<PlayerStatusType>(null, stat);
status.InitMinMaxVal(PlayerStatusType.exp, 0, PlayerStatType.maxEXP, 0);
status.InitMinMaxVal(PlayerStatusType.gold, 0, PlayerStatType.maxGold, 0);
status.InitMinMaxVal(PlayerStatusType.key, 0, PlayerStatType.maxKey, 0);
status.InitMinMaxVal(PlayerStatusType.feverPoint, 0, PlayerStatType.maxFeverPoint, 0);
/*
actionHandler = new ActionHandler(status);
AddAction(Action.E_Type.Money,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(PlayerStatusType.gold, value);
}
);
AddAction(Action.E_Type.Exp,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(PlayerStatusType.exp, value);
}
);
*/
status.RegisterOnChangeEvent(PlayerStatusType.gold, onGoldChanged);
commandQueue = new TimedConsumableCommandSet(100, false, null, onChargedAttack);
}