public Element(ElementKind kind, Dictionary<string, object> startTagTokens) { Kind = kind; StartTagTokens = startTagTokens; EndTagTokens = new Dictionary<string, object>(); Children = new List<Element>(); }
internal static String CreateElementKindString(ElementKind elementKind, GeneralArrayInfo arrayInfo) { var builder = new StringBuilder(); CreateElementKindString(elementKind, arrayInfo, builder); return(builder.ToString()); }
public Element(ElementKind kind, Dictionary <string, object> startTagTokens) { Kind = kind; StartTagTokens = startTagTokens; EndTagTokens = new Dictionary <string, object>(); Children = new List <Element>(); }
public Element(ElementKind kind, Dictionary <string, object> startTagTokens, Dictionary <string, object> endTagTokens, List <Element> children) { Kind = kind; StartTagTokens = startTagTokens; EndTagTokens = endTagTokens; Children = children; }
public Element(ElementKind kind, Token startTag) { Kind = kind; StartTagTokens = new Dictionary<string, object> { { "", startTag } }; EndTagTokens = new Dictionary<string, object>(); Children = new List<Element>(); }
public Element(ElementKind kind, Dictionary<string, object> startTagTokens, Dictionary<string, object> endTagTokens, List<Element> children) { Kind = kind; StartTagTokens = startTagTokens; EndTagTokens = endTagTokens; Children = children; }
//攻撃力と他のステータスを受け取り、防御力を適用しダメージ算出 public void Damage(int attackPower,ElementKind element, float magnification) { var calcDamage = CalcDamage(attackPower, element, magnification); characterParameter.HP -= calcDamage; CreateDamageText(calcDamage); animator.SetDamage(); //character.StateUI.UpdateUI(); }
public Element(ElementKind kind, Token startTag) { Kind = kind; StartTagTokens = new Dictionary <string, object> { { "", startTag } }; EndTagTokens = new Dictionary <string, object>(); Children = new List <Element>(); }
//攻撃力と他のステータスを受け取り、防御力を適用しダメージ算出 public void Damage(int attackPower, ElementKind element, float magnification) { var calcDamage = CalcDamage(attackPower, element, magnification); characterParameter.HP -= calcDamage; CreateDamageText(calcDamage); animator.SetDamage(); //character.StateUI.UpdateUI(); }
private static void CreateElementKindString(ElementKind elementKind, GeneralArrayInfo arrayInfo, StringBuilder builder) { switch (elementKind) { case ElementKind.Array: builder.Append('['); if (arrayInfo != null) { if (arrayInfo.Rank == 1 && arrayInfo.Sizes.Count == 0 && arrayInfo.LowerBounds.Count == 0) { // Special case builder.Append('*'); } else { for (var i = 0; i < arrayInfo.Rank; ++i) { var appendLoBound = i < arrayInfo.LowerBounds.Count; if (appendLoBound) { var loBound = arrayInfo.LowerBounds[i]; appendLoBound = loBound != 0; if (appendLoBound) { builder.Append(loBound).Append(".."); } } if (i < arrayInfo.Sizes.Count) { builder.Append(arrayInfo.Sizes[i]); } else if (appendLoBound) { builder.Append('.'); } if (i < arrayInfo.Rank - 1) { builder.Append(','); } } } } builder.Append(']'); break; case ElementKind.Pointer: builder.Append('*'); break; case ElementKind.Reference: builder.Append('&'); break; } }
public ItemSpawner(HexData.Addition data) { count = data.count; kind = data.kind; itemType = data.type; minRespTime = data.minRespawnTime; maxRespTime = data.maxRespawnTime; firstSpawn = data.respawnOnStart; roundCounter = 0; requiredRound = URandom.Range(minRespTime, maxRespTime + 1); }
private Operation CreateOperationFromAttribute( XElement element, ElementKind kind, XAttribute attribute, bool throwOnId = false) { string attributeName = attribute.LocalName(); if (throwOnId && DefaultComparer.NameEquals(attributeName, AttributeNames.Id)) { Throw(ErrorMessages.CannotUseOperationOnProperty(element, attributeName)); } PropertyDefinition property; string name = attribute.LocalName(); if (name == PropertyDefinition.TagsName) { property = PropertyDefinition.Tags; } else { property = GetProperty(attribute); } switch (kind) { case ElementKind.With: { return(new Operation(property, GetValue(attribute), _depth, OperationKind.With)); } case ElementKind.Without: { if (!property.IsCollection) { Throw(ErrorMessages.CannotUseOperationOnNonCollectionProperty(element, property.Name)); } return(new Operation(property, GetValue(attribute), _depth, OperationKind.Without)); } default: { Debug.Assert(kind == ElementKind.New, kind.ToString()); return(new Operation(property, GetValue(attribute), _depth, OperationKind.With)); } } }
public static Type GetMatchingType(this ElementKind kind) { switch (kind) { case ElementKind.Boolean: return(typeof(bool)); case ElementKind.Float32: return(typeof(float)); case ElementKind.Int32: return(typeof(int)); } throw new NotSupportedException(); }
public Shape(ElementKind kind, IReadOnlyList <int> dimensions) { Kind = kind; Dimensions = dimensions; }
public virtual void InitElement(ElementKind kind, string name) { FKind = kind; FName = name; }
private IEnumerable <IPropertyOperation> CreateOperationsFromElement(XElement element, bool throwOnMultiCommand = false) { Debug.Assert(element.HasAttributes, element.ToString()); ElementKind kind = element.Kind(); switch (kind) { case ElementKind.Set: { foreach (XAttribute attribute in element.Attributes()) { yield return(CreateOperationFromAttribute(element, kind, attribute, throwOnId: true, throwOnCollection: true)); } break; } case ElementKind.Postfix: { foreach (XAttribute attribute in element.Attributes()) { yield return(new PostfixOperation(GetProperty(attribute), GetValue(attribute), Depth)); } break; } case ElementKind.PostfixMany: { if (throwOnMultiCommand) { ThrowInvalidOperation(ErrorMessages.CommandCannotBeUsedAsChildCommandOfNewCommand(element)); } foreach (XAttribute attribute in element.Attributes()) { yield return(new PostfixManyOperation(GetProperty(attribute), GetValue(attribute), Depth)); } break; } case ElementKind.Prefix: { foreach (XAttribute attribute in element.Attributes()) { yield return(new PrefixOperation(GetProperty(attribute), GetValue(attribute), Depth)); } break; } case ElementKind.PrefixMany: { if (throwOnMultiCommand) { ThrowInvalidOperation(ErrorMessages.CommandCannotBeUsedAsChildCommandOfNewCommand(element)); } foreach (XAttribute attribute in element.Attributes()) { yield return(new PrefixManyOperation(GetProperty(attribute), GetValue(attribute), Depth)); } break; } case ElementKind.Add: case ElementKind.Remove: { foreach (XAttribute attribute in element.Attributes()) { yield return(CreateOperationFromAttribute(element, kind, attribute, throwOnId: true)); } break; } case ElementKind.AddRange: case ElementKind.RemoveRange: { char separator = ','; foreach (XAttribute attribute in element.Attributes()) { switch (attribute.LocalName()) { case AttributeNames.Separator: { string separatorText = attribute.Value; if (separatorText.Length != 1) { Throw("Separator must be a single character", attribute); } separator = separatorText[0]; break; } default: { yield return(CreateOperationFromAttribute(element, kind, attribute, separator: separator, throwOnId: true)); break; } } } break; } default: { Throw(ErrorMessages.OperationIsNotDefined(element.LocalName())); break; } } }
//ここを変えるとダメージが変わる //計算式(ATK-1/2DEF)*magnification int CalcDamage(int power, ElementKind element, float magnification) { var deffence = element == ElementKind.なし ? character.characterParameter.deffence : character.characterParameter.elementDeffence; return(Mathf.Max(0, (int)((power - (1 / 2 * deffence)) * magnification))); }
public static Type GetTensorType(this ElementKind kind) { return(typeof(Tensor <>).MakeGenericType(kind.GetMatchingType())); }
private IEnumerable <Operation> CreateOperationsFromElement(XElement element) { Debug.Assert(element.HasAttributes, element.ToString()); ElementKind kind = element.Kind(); switch (kind) { case ElementKind.With: case ElementKind.Without: { foreach (XAttribute attribute in element.Attributes()) { yield return(CreateOperationFromAttribute(element, kind, attribute, throwOnId: true)); } //TODO: Separator //char separator = ','; //foreach (XAttribute attribute in element.Attributes()) //{ // switch (attribute.LocalName()) // { // case AttributeNames.Separator: // { // string separatorText = attribute.Value; // if (separatorText.Length != 1) // Throw("Separator must be a single character", attribute); // separator = separatorText[0]; // break; // } // default: // { // yield return CreateOperationFromAttribute(element, kind, attribute, separator: separator, throwOnId: true); // break; // } // } //} break; } case ElementKind.Postfix: { foreach (XAttribute attribute in element.Attributes()) { yield return(new Operation(GetProperty(attribute), GetValue(attribute), _depth, OperationKind.Postfix)); } break; } case ElementKind.Prefix: { foreach (XAttribute attribute in element.Attributes()) { yield return(new Operation(GetProperty(attribute), GetValue(attribute), _depth, OperationKind.Prefix)); } break; } default: { Throw(ErrorMessages.OperationIsNotDefined(element.LocalName())); break; } } }
//ここを変えるとダメージが変わる //計算式(ATK-1/2DEF)*magnification int CalcDamage(int power,ElementKind element, float magnification) { var deffence = element == ElementKind.なし ? character.characterParameter.deffence : character.characterParameter.elementDeffence; return Mathf.Max(0, (int)((power - (1 / 2 * deffence)) * magnification)); }
public static bool IsKind(this XElement element, ElementKind kind) { return(element.Kind() == kind); }
private int volume; // cm^3 /** * @param kind * @param volume in cm^3 */ public GameElement(ElementKind kind, int volume) { super(kind.getName(), kind.getSymbol()); this.kind = kind; this.volume = volume; }
private IPropertyOperation CreateOperationFromAttribute( XElement element, ElementKind kind, XAttribute attribute, char separator = ',', bool throwOnId = false, bool throwOnCollection = false) { string attributeName = attribute.LocalName(); if (throwOnId && DefaultComparer.NameEquals(attributeName, AttributeNames.Id)) { Throw(ErrorMessages.CannotUseOperationOnProperty(element, attributeName)); } PropertyDefinition property; string name = attribute.LocalName(); if (name == PropertyDefinition.TagsName) { property = PropertyDefinition.Tags; } else { property = GetProperty(attribute); } if (throwOnCollection && property.IsCollection) { Throw(ErrorMessages.CannotUseOperationOnCollectionProperty(element, property.Name)); } switch (kind) { case ElementKind.Add: return(new AddOperation(property, GetValue(attribute), Depth)); case ElementKind.AddRange: return(new AddRangeOperation(property, GetValue(attribute), separator, Depth)); case ElementKind.Remove: return(new RemoveOperation(property, GetValue(attribute), Depth)); case ElementKind.RemoveRange: return(new RemoveRangeOperation(property, GetValue(attribute), separator, Depth)); default: { Debug.Assert(kind == ElementKind.Set || kind == ElementKind.New, kind.ToString()); if (property.IsCollection) { return(new AddOperation(property, GetValue(attribute), Depth)); } else { return(new SetOperation(property, GetValue(attribute), Depth)); } } } }
public Shape(ElementKind kind, IReadOnlyList <int> dimensions) { Kind = kind; Dimensions = dimensions ?? throw new ArgumentNullException(nameof(dimensions)); }