Пример #1
0
 public void Deconstruct(out TypeUnits pMeanVariance, out TypeUnitsRange pMeanVarianceRange, out Reference pMeanVarianceType, out int?pMeanVarianceTypeId, out int?pOrder, out List <MeanVariances> pOwners, out int?pOwnersCount)
 {
     pMeanVariance       = MeanVariance;
     pMeanVarianceRange  = MeanVarianceRange;
     pMeanVarianceType   = MeanVarianceType;
     pMeanVarianceTypeId = MeanVarianceTypeId;
     pOrder       = Order;
     pOwners      = Owners;
     pOwnersCount = OwnersCount;
 }
Пример #2
0
 public MeanVarianceValueBase(int?pId, TypeUnits pMeanVariance, TypeUnitsRange pMeanVarianceRange, Reference pMeanVarianceType, int?pMeanVarianceTypeId, int?pOrder, List <MeanVariances> pOwners, int?pOwnersCount) : this(DocConvert.ToInt(pId))
 {
     MeanVariance       = pMeanVariance;
     MeanVarianceRange  = pMeanVarianceRange;
     MeanVarianceType   = pMeanVarianceType;
     MeanVarianceTypeId = pMeanVarianceTypeId;
     Order       = pOrder;
     Owners      = pOwners;
     OwnersCount = pOwnersCount;
 }
Пример #3
0
 public MeanRangeValueBase(int?pId, Reference pMeanVarianceType, int?pMeanVarianceTypeId, TypeUnits pMidSpread, int?pOrder, List <MeanRanges> pOwners, int?pOwnersCount, decimal?pPercent, decimal?pPercentLow, TypeUnitsRange pRange, Reference pType, int?pType_Id) : this(DocConvert.ToInt(pId))
 {
     MeanVarianceType   = pMeanVarianceType;
     MeanVarianceTypeId = pMeanVarianceTypeId;
     MidSpread          = pMidSpread;
     Order       = pOrder;
     Owners      = pOwners;
     OwnersCount = pOwnersCount;
     Percent     = pPercent;
     PercentLow  = pPercentLow;
     Range       = pRange;
     Type        = pType;
     Type_Id     = pType_Id;
 }
Пример #4
0
 public MeanVarianceValue(int?pId, TypeUnits pMeanVariance, TypeUnitsRange pMeanVarianceRange, Reference pMeanVarianceType, int?pMeanVarianceTypeId, int?pOrder, List <MeanVariances> pOwners, int?pOwnersCount) :
     base(pId, pMeanVariance, pMeanVarianceRange, pMeanVarianceType, pMeanVarianceTypeId, pOrder, pOwners, pOwnersCount)
 {
 }
Пример #5
0
 public MeanRangeValue(int?pId, Reference pMeanVarianceType, int?pMeanVarianceTypeId, TypeUnits pMidSpread, int?pOrder, List <MeanRanges> pOwners, int?pOwnersCount, decimal?pPercent, decimal?pPercentLow, TypeUnitsRange pRange, Reference pType, int?pType_Id) :
     base(pId, pMeanVarianceType, pMeanVarianceTypeId, pMidSpread, pOrder, pOwners, pOwnersCount, pPercent, pPercentLow, pRange, pType, pType_Id)
 {
 }
Пример #6
0
 public void Deconstruct(out Reference pMeanVarianceType, out int?pMeanVarianceTypeId, out TypeUnits pMidSpread, out int?pOrder, out List <MeanRanges> pOwners, out int?pOwnersCount, out decimal?pPercent, out decimal?pPercentLow, out TypeUnitsRange pRange, out Reference pType, out int?pType_Id)
 {
     pMeanVarianceType   = MeanVarianceType;
     pMeanVarianceTypeId = MeanVarianceTypeId;
     pMidSpread          = MidSpread;
     pOrder       = Order;
     pOwners      = Owners;
     pOwnersCount = OwnersCount;
     pPercent     = Percent;
     pPercentLow  = PercentLow;
     pRange       = Range;
     pType        = Type;
     pType_Id     = Type_Id;
 }
Пример #7
0
        public void SpawnUnit(TypeUnits typeUnits, bool withoutFood = false)
        {
            Unit unit = null;

            switch (typeUnits)
            {
            case TypeUnits.Rustic:
                unit = rusticUnit;
                break;

            case TypeUnits.Knight:
                unit = knightUnit;
                break;

            case TypeUnits.WizEarth:
                unit = wizEarthUnit;
                break;

            case TypeUnits.WizFire:
                unit = wizFireUnit;
                break;

            case TypeUnits.WizWater:
                unit = wizWaterUnit;
                break;
            }

            if (FoodController.Get.Food >= unit.price || withoutFood)
            {
                /*if (unit is WizWaterUnit && !wizWaterUnit.gameObject.activeSelf)
                 * {
                 *      wizWaterUnit.gameObject.SetActive(true);
                 *      if(!withoutFood)
                 *              FoodController.Get.Decrement(unit.price);
                 * }
                 * if (unit is WizFireUnit && !wizFireUnit.gameObject.activeSelf)
                 * {
                 *      wizFireUnit.gameObject.SetActive(true);
                 *      if(!withoutFood)
                 *              FoodController.Get.Decrement(unit.price);
                 * }
                 * if (unit is WizEarthUnit && !wizEarthUnit.gameObject.activeSelf)
                 * {
                 *      wizEarthUnit.gameObject.SetActive(true);
                 *      if(!withoutFood)
                 *              FoodController.Get.Decrement(unit.price);
                 * }*/

                var newUnit = Instantiate(unit, unitsPlace);


                var pos          = posForSpawn[posToSpawn];
                var hexagonByPos = Field.GetHexagonByPos((int)pos.x, (int)pos.y);
                posToSpawn++;
                if (posToSpawn >= posForSpawn.Length)
                {
                    posToSpawn = 0;
                }
                if (!hexagonByPos.IsUnitAdd)
                {
                    if (!withoutFood)
                    {
                        FoodController.Get.Decrement(unit.price);
                    }
                    hexagonByPos.IsUnitAdd     = true;
                    newUnit.transform.position = hexagonByPos.transform.position;
                    newUnit.Field      = Field;
                    newUnit.CurHexagon = hexagonByPos;
                    newUnit.IdUnit     = idUnit++;
                    newUnit.IdPlayer   = IdPlayer;

                    if (isSending && IsPlayer)
                    {
                        isSending = false;
                        buffer[0] = Commands.SpawnUnit;
                        buffer[1] = (byte)typeUnits;
                        SendSpawn();
                    }
                }
                else
                {
                    Destroy(newUnit.gameObject);
                }
            }
        }