Exemplo n.º 1
0
        public static Elements GetElements(this ElementEnum element)
        {
            var elementDictionary = new Dictionary <ElementEnum, int>();

            foreach (ElementEnum color in Enum.GetValues(typeof(ElementEnum)))
            {
                if (color != ElementEnum.None)
                {
                    //Each color has 3 levels and each level is represented by a bit flag, each flag is double the previous value.
                    //                              Base Value +   Base Value   * 2 +   Base Value   * 2 * 2 = Value Representing all levels for that element.
                    //@TODO Consider caching colorFlags value in a readonly static variable.
                    var colorFlags = (ElementEnum)((ushort)color + (ushort)color * 2 + (ushort)color * 2 * 2);
                    var level      = 0;

                    while ((element & colorFlags) != 0)
                    {
                        element -= color;
                        level++;
                    }

                    if (level > 0)
                    {
                        elementDictionary.Add(color, level);
                    }
                }
            }

            return(elementDictionary);
        }
        public TeamGroupType(ITypeSupplier typeSupplier, ElementEnum enumData) : base(enumData, typeSupplier, false)
        {
            Opposite = new InternalVar("Opposite", this, CompletionItemKind.Property)
            {
                Documentation = new MarkupBuilder()
                                .Add("The opposite team of the value. If the team value is ").Code("Team 1").Add(", Opposite will be ").Code("Team 2").Add(" and vice versa. If the value is ")
                                .Code("All").Add(", Opposite will still be ").Code("All").Add(".")
            };
            Score = new InternalVar("Score", typeSupplier.Number(), CompletionItemKind.Property)
            {
                Documentation = new MarkupBuilder()
                                .Add("The current score for the team. Results in 0 in free-for-all modes.")
            };
            OnDefense = new InternalVar("OnDefense", typeSupplier.Boolean(), CompletionItemKind.Property)
            {
                Documentation = new MarkupBuilder()
                                .Add("Whether the specified team is currently on defense. Results in False if the game mode is not Assault, Escort, or Assault/Escort.")
            };
            OnOffense = new InternalVar("OnOffense", typeSupplier.Boolean(), CompletionItemKind.Property)
            {
                Documentation = new MarkupBuilder()
                                .Add("Whether the specified team is currently on offense. Results in False if the game mode is not Assault, Escort, or Assault/Escort.")
            };

            _objectScope.AddNativeVariable(Opposite);
            _objectScope.AddNativeVariable(Score);
            _objectScope.AddNativeVariable(OnDefense);
            _objectScope.AddNativeVariable(OnOffense);
        }
Exemplo n.º 3
0
    public RectTransform AddPlayer(int index, ElementEnum element)
    {
        RectTransform newGui = Instantiate(guiPrefabs[(int)element]) as RectTransform;

        newGui.position = guiPositions[index].position;
        newGui.parent   = guiPositions[index];
        return(newGui);
    }
Exemplo n.º 4
0
        public void Init(UnityAction <bool> action, ElementEnum type, ToggleGroup group)
        {
            Toggle.group = group;
            Toggle.onValueChanged.AddListener(action);
            ElementType elementType = Array.Find(ElementsTypes.Instance.Types, t => t.Type == type);

            Toggle.image.sprite = elementType.Sprite;
            Checkmark.color     = Color.black;
            Checkmark.sprite    = elementType.Sprite;
        }
Exemplo n.º 5
0
 public DamSingleTar(int a,int c,int s,int bd, ElementEnum t,string n)
 {
     Level = 0;
     Animation = a;
     Cost = c;
     Speed = s;
     BasDam = bd;
     Type = t;
     Name = n;
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Awake()
    {
        switch (elementString)
        {
        case "fire":
            element = ElementEnum.Fire;
            break;

        case "ice":
            element = ElementEnum.Ice;
            break;

        case "lightning":
            element = ElementEnum.Lightning;
            break;
        }

        //rb = GetComponent<Rigidbody2D>();
        //      target = GameObject.Find("Skeleton").transform;
    }
    void DisplayAddMainArea()
    {
        newAbilityName = EditorGUILayout.TextField(new GUIContent("Name: "), newAbilityName);
        newAbilityBaseDamage = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Base Damage: "), newAbilityBaseDamage.ToString()));
        newAbilityCost = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Cost: "), newAbilityCost.ToString()));
        newAbilitySpeed = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Speed: "), newAbilitySpeed.ToString()));
        newAbilityAnimation =Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Animation: "), newAbilitySpeed.ToString()));
        newAbilityType = (ElementEnum)EditorGUILayout.EnumPopup (ElementEnum.Air);

        EditorGUILayout.Space();
        if (GUILayout.Button("Done", GUILayout.Width(100)))
        {
            Abilities.Add(new DamSingleTar(newAbilityAnimation,newAbilityCost,newAbilitySpeed,newAbilityBaseDamage,newAbilityType,newAbilityName));
            Abilities.SortAlphabeticallyAtoZ();
            newAbilityName = string.Empty;
            newAbilityBaseDamage = 0;
            EditorUtility.SetDirty(Abilities);
            state = State.BLANK;
        }
    }
        public ValueGroupType(ElementEnum enumData, ITypeSupplier types, bool constant) : base(enumData.Name)
        {
            _staticScope = new Scope("enum " + Name);
            _objectScope = new Scope("enum " + Name);
            _constant    = constant;
            EnumData     = enumData;
            TokenType    = SemanticTokenType.Enum;

            if (constant)
            {
                TokenModifiers.Add(TokenModifier.Readonly);
            }

            foreach (ElementEnumMember member in enumData.Members)
            {
                EnumValuePair newPair = new EnumValuePair(member, constant, this);
                _valuePairs.Add(newPair);
                _staticScope.AddNativeVariable(newPair);
            }

            Operations.DefaultAssignment = !constant;
        }
Exemplo n.º 9
0
 public ResolveQuery(ElementEnum kind, string Entityname)
 {
     this.Kind     = kind;
     this.TypeName = Entityname;
 }
 private static CompletionItem[] GetItems(ElementEnum elementEnum) => elementEnum.Members.Select(m => new CompletionItem()
 {
     Label  = m.CodeName(),
     Detail = m.CodeName(),
     Kind   = CompletionItemKind.Constant
 }).ToArray();
Exemplo n.º 11
0
 /// <summary>
 /// Checks if <c>b</c> is countered by <c>a</c>
 /// </summary>
 public bool Countered(ElementEnum a, ElementEnum b)
 {
     return(a == ElementEnum.Water && b == ElementEnum.Fire ||
            a == ElementEnum.Earth && b == ElementEnum.Water ||
            a == ElementEnum.Fire && b == ElementEnum.Earth);
 }
Exemplo n.º 12
0
    private void Start()
    {
        ElementEnum currentElement = _applyElement ? _applyElement.CurrentElement.ElementEnum : _applyElementChance.CurrentElement.ElementEnum;

        GetComponent <Animator>().SetInteger("element", (int)currentElement);
    }