Пример #1
0
 public ContentRange(RangeUnit unit, long?start, long?end, long?size)
 {
     Start = start;
     End   = end;
     Size  = size;
     Unit  = unit;
 }
Пример #2
0
        // Token: 0x0600003C RID: 60 RVA: 0x00005BC0 File Offset: 0x00003DC0
        private void OnUnitRemoved(Unit9 unit)
        {
            if (!unit.IsHero || unit.IsIllusion)
            {
                return;
            }
            RangeUnit rangeUnit = this.rangeUnits.Find((RangeUnit x) => x.Handle == unit.Handle);

            if (rangeUnit == null)
            {
                return;
            }
            rangeUnit.Dispose();
            this.rangeUnits.Remove(rangeUnit);
        }
Пример #3
0
 // Token: 0x0600003A RID: 58 RVA: 0x00005B44 File Offset: 0x00003D44
 private void OnAbilityRemoved(Ability9 ability)
 {
     try
     {
         if (!ability.IsTalent && !ability.IsStolen)
         {
             RangeUnit rangeUnit = this.rangeUnits.Find((RangeUnit x) => x.Handle == ability.Owner.Handle);
             if (rangeUnit != null)
             {
                 rangeUnit.RemoveAbility(ability);
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Пример #4
0
    void InitiatUnit()
    {
        for (int i = 0; i < 10; i++)
        {
            int factionRnd = UnityEngine.Random.Range(1, 3);//random for both factions betteween 1 and 2
            int rndX       = UnityEngine.Random.Range(0, 20);
            int rndY       = UnityEngine.Random.Range(0, 20);
            if (factionRnd == 1)
            {
                int typeRnd = UnityEngine.Random.Range(1, 3); //random for class type
                if (typeRnd == 1)
                {
                    int classRnd = UnityEngine.Random.Range(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Hero", unitType: "Sniper", symbol: 'R');
                        units[i].MaxHp = 10;
                    }
                    else
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Hero", unitType: "Archer", symbol: 'R');
                        units[i].MaxHp = 10;
                    }
                }
                else
                {
                    int classRnd = UnityEngine.Random.Range(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Hero", unitType: "Tank", symbol: 'M');
                        units[i].MaxHp = 20;
                    }
                    else
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Hero", unitType: "Slayer", symbol: 'M');
                        units[i].MaxHp = 20;
                    }
                }
            }
            else
            {
                int typeRnd = UnityEngine.Random.Range(1, 3); //random for class type
                if (typeRnd == 1)
                {
                    int classRnd = UnityEngine.Random.Range(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Enemy", unitType: "Sniper", symbol: 'T');
                        units[i].MaxHp = 10;
                    }
                    else
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Enemy", unitType: "Archer", symbol: 'T');
                        units[i].MaxHp = 10;
                    }
                }
                else
                {
                    int classRnd = UnityEngine.Random.Range(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Enemy", unitType: "Tank", symbol: 'W');
                        units[i].MaxHp = 20;
                    }
                    else
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Enemy", unitType: "Slayer", symbol: 'W');
                        units[i].MaxHp = 20;
                    }
                }
            }
        }

        int xRnd = UnityEngine.Random.Range(0, 19);

        int yRnd = UnityEngine.Random.Range(0, 19);

        buildings[0]       = new ResourceBuilding(40, xRnd, yRnd, "Hero", 'Y');
        buildings[0].YPos  = yRnd;
        buildings[0].MaxHp = 40;


        xRnd = UnityEngine.Random.Range(0, 20);
        yRnd = UnityEngine.Random.Range(0, 20);

        buildings[1]       = new ResourceBuilding(40, xRnd, yRnd, "Enemy", 'A');
        buildings[1].YPos  = yRnd;
        buildings[1].MaxHp = 40;


        xRnd = UnityEngine.Random.Range(0, 20);

        yRnd = UnityEngine.Random.Range(0, 20);

        buildings[2]       = new FactoryBuilding(40, xRnd, yRnd, "Hero", 'X');
        buildings[2].YPos  = yRnd;
        buildings[2].MaxHp = 40;
        int rndSpn = UnityEngine.Random.Range(1, 3);

        // if (rndSpn == 1)
        //   {
        //      fBuildings[0].UnitSpn = "Meele";
        //       fBuildings[0].SpnTic = 5;
        //       fBuildings[0].SpnPtCalc();
        //    }
        //   else
        //   {
        //       fBuildings[0].UnitSpn = "Range";
        //       fBuildings[0].SpnTic = 5;
        //       fBuildings[0].SpnPtCalc();
        //   }

        xRnd = UnityEngine.Random.Range(0, 20);

        yRnd = UnityEngine.Random.Range(0, 20);

        buildings[3]       = new FactoryBuilding(40, xRnd, yRnd, "Enemy", 'B');
        buildings[3].YPos  = yRnd;
        buildings[3].MaxHp = 40;
        rndSpn             = UnityEngine.Random.Range(1, 3);
        //   if (rndSpn == 1)
        //   {
        //       fBuildings[1].UnitSpn = "Meele";
        //       fBuildings[1].SpnTic = 5;
        //        fBuildings[1].SpnPtCalc();
        //   }
        //   else
        //   {
        //       fBuildings[1].UnitSpn = "Range";
        //      fBuildings[1].SpnTic = 5;
        //      fBuildings[1].SpnPtCalc();
        //  }
    }
Пример #5
0
 /// <summary>
 /// Indicates whether this instance and a specified <see cref="RangeUnit"/> are equal
 /// </summary>
 public bool Equals(RangeUnit other) => string.Equals(_value, other._value, StringComparison.Ordinal);
Пример #6
0
 public QueryRange(int number, RangeUnit unit)
 {
     _number = number;
     _unit   = unit;
 }
Пример #7
0
    public void UnitSpawner()    //
    {
        for (int j = 0; j < units.Length; j++)
        {
            int UnitType;
            int factionAllocte;

            int    x       = rand.Next(1, 20);
            int    y       = rand.Next(1, 20);
            string faction = "";
            string symbol  = "";
            UnitType = rand.Next(1, 5);

            switch (UnitType)
            {
            case 1:         //Melee baby sharks
                factionAllocte = rand.Next(1, 3);
                switch (factionAllocte)
                {
                case 1:             //hammerHead sharks
                    faction = "Hammerhead";
                    symbol  = "H";
                    break;

                case 2:             //raggertooth sharks
                    faction = "Raggertooth";
                    symbol  = "R";
                    break;
                }
                units[j] = new MeleeUnit(x, y, faction, symbol);
                break;

            case 2:         //Ranged baby sharks
                factionAllocte = rand.Next(1, 3);
                switch (factionAllocte)
                {
                case 1:
                    faction = "Hammerhead";
                    symbol  = "h";
                    break;

                case 2:
                    faction = "Raggertooth";
                    symbol  = "r";
                    break;
                }
                units[j] = new RangeUnit(x, y, faction, symbol);
                break;

            case 3:         //cutie baby sharks0
                factionAllocte = rand.Next(1, 3);
                switch (factionAllocte)
                {
                case 1:             //hammerHead sharks
                    faction = "Hammerhead";
                    symbol  = "C";
                    break;

                case 2:             //raggertooth sharks
                    faction = "Raggertooth";
                    symbol  = "c";
                    break;
                }
                units[j] = new Cutie(x, y, faction, symbol);
                break;

            case 4:         //agro baby sharks
                factionAllocte = rand.Next(1, 3);
                switch (factionAllocte)
                {
                case 1:             //hammerHead sharks
                    faction = "Hammerhead";
                    symbol  = "A";
                    break;

                case 2:             //raggertooth sharks
                    faction = "Raggertooth";
                    symbol  = "a";
                    break;
                }
                units[j] = new AgroSharks(x, y, faction, symbol);
                break;
            }
            //GameMap[units[j].YPos, units[j].XPos] = units[j].Symbol;
        }
    }
Пример #8
0
    public Map()    //fills map and array
    {
        for (int i = 0; i < 20; ++i)
        {
            for (int j = 0; j < 20; ++j)
            {
                mapArr[i, j] = ',';
            }
        }

        for (int i = 0; i < 10; i++)
        {
            int factionRnd = r.Next(1, 3);   //random for both factions betteween 1 and 2
            int rndX       = r.Next(0, 19);
            int rndY       = r.Next(0, 19);
            if (factionRnd == 1)
            {
                int typeRnd = r.Next(1, 3);     //random for class type
                if (typeRnd == 1)
                {
                    int classRnd = r.Next(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Hero", unitType: "Sniper", symbol: 'R');
                        units[i].MaxHp = 10;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                    else
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Hero", unitType: "Archer", symbol: 'R');
                        units[i].MaxHp = 10;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                }
                else
                {
                    int classRnd = r.Next(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Hero", unitType: "Tank", symbol: 'M');
                        units[i].MaxHp = 20;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                    else
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Hero", unitType: "Slayer", symbol: 'M');
                        units[i].MaxHp = 20;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                }
            }
            else
            {
                int typeRnd = r.Next(1, 3);     //random for class type
                if (typeRnd == 1)
                {
                    int classRnd = r.Next(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Enemy", unitType: "Sniper", symbol: 'T');
                        units[i].MaxHp = 10;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                    else
                    {
                        units[i]       = new RangeUnit(10, 10, 1, 2, 2, rndX, rndY, faction: "Enemy", unitType: "Archer", symbol: 'T');
                        units[i].MaxHp = 10;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                }
                else
                {
                    int classRnd = r.Next(1, 3);
                    if (classRnd == 1)
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Enemy", unitType: "Tank", symbol: 'W');
                        units[i].MaxHp = 20;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                    else
                    {
                        units[i]       = new MeeleUnit(20, 20, 2, 1, 1, rndX, rndY, faction: "Enemy", unitType: "Slayer", symbol: 'W');
                        units[i].MaxHp = 20;
                        units[i].XPos  = rndX;
                        units[i].YPos  = rndY;
                    }
                }
            }
        }

        int xRnd = r.Next(0, 19);

        int yRnd = r.Next(0, 19);

        rBuildings[0]                   = new ResourceBuilding(40, xRnd, yRnd, "Hero", 'Y');
        rBuildings[0].YPos              = yRnd;
        rBuildings[0].ResourcePerTic    = 1;
        rBuildings[0].ResType           = "Wood";
        rBuildings[0].ResourceRemaining = 20;


        xRnd = r.Next(0, 20);
        yRnd = r.Next(0, 20);

        rBuildings[1]                   = new ResourceBuilding(40, xRnd, yRnd, "Enemy", 'A');
        rBuildings[1].YPos              = yRnd;
        rBuildings[1].ResourcePerTic    = 1;
        rBuildings[1].ResType           = "Wood";
        rBuildings[1].ResourceRemaining = 20;


        xRnd = r.Next(0, 20);

        yRnd = r.Next(0, 20);

        fBuildings[0]      = new FactoryBuilding(40, xRnd, yRnd, "Hero", 'X');
        fBuildings[0].YPos = yRnd;
        int rndSpn = r.Next(1, 3);

        if (rndSpn == 1)
        {
            fBuildings[0].UnitSpn = "Meele";
            fBuildings[0].SpnTic  = 5;
            fBuildings[0].SpnPtCalc();
        }
        else
        {
            fBuildings[0].UnitSpn = "Range";
            fBuildings[0].SpnTic  = 5;
            fBuildings[0].SpnPtCalc();
        }

        xRnd = r.Next(0, 20);

        yRnd = r.Next(0, 20);

        fBuildings[1]      = new FactoryBuilding(40, xRnd, yRnd, "Enemy", 'B');
        fBuildings[0].YPos = yRnd;
        rndSpn             = r.Next(1, 3);
        if (rndSpn == 1)
        {
            fBuildings[1].UnitSpn = "Meele";
            fBuildings[1].SpnTic  = 5;
            fBuildings[1].SpnPtCalc();
        }
        else
        {
            fBuildings[1].UnitSpn = "Range";
            fBuildings[1].SpnTic  = 5;
            fBuildings[1].SpnPtCalc();
        }
    }
Пример #9
0
 public XRange(int value, RangeUnit unit)
 {
     Value = value;
     Unit  = unit;
 }