Example #1
0
    //광고종료시에 얘를 호출
    public void initScene(BonusType bonusType)
    {
        //canvas 활성화
        canvas.active = true;

        //결과표시
        showPlayData();

        //시체표시
        showDeadBody();

        //검정 페이드아웃
        uiFadeOut(black, 1f);


        //투명도초기화
        spotLight.GetComponent <CanvasRenderer>().SetAlpha(0f);
        text.GetComponent <CanvasRenderer>().SetAlpha(0f);

        //멘트설정
        DieText dieText = new DieText();

        text.text = dieText.getDieText();

        //코루틴시작
        StartCoroutine(dieScenario(bonusType));
    }
Example #2
0
        private int TryFindBonus(Tank self, BonusType btype, bool any = false)
        {
            int    bonusId = world.Bonuses.Length;
            double maxK    = 0;

            for (int i = 0; i < world.Bonuses.Length; i++)
            {
                if ((any || world.Bonuses[i].Type == btype) && IsNeed(self, world.Bonuses[i]))
                {
                    double x = world.Bonuses[i].X;
                    double y = world.Bonuses[i].Y;
                    if ((!InRect(x1, x2, y1, y2, x, y) && !Intersected(self.X, self.Y, x, y, rectX, rectY)) || CountAlive() < 4)
                    {
                        int interCount = 0;
                        Intersected(self, world.Bonuses[i], ref interCount);
                        double k = TankCoeff(self, world.Bonuses[i]);
                        double d = self.GetDistanceTo(world.Bonuses[i]);

                        if (interCount == 0 && k > maxK && (d < self.Width * 6 || CountAlive() < 3))
                        {
                            maxK    = k;
                            bonusId = i;
                        }
                    }
                }
            }
            return(bonusId);
        }
Example #3
0
        public async Task AddUserTokenBalance(string userId, BigInteger amount, BonusType bonusType)
        {
            var user = await appDbContext.Users.FindAsync(userId);

            switch (bonusType)
            {
            case BonusType.None:
                user.ZinTokens = BigInteger.Add(BigInteger.Parse(user.ZinTokens), amount).ToString();
                break;

            case BonusType.Presale:
                user.PresaleZinTokens = BigInteger.Add(BigInteger.Parse(user.PresaleZinTokens), amount).ToString();
                break;

            case BonusType.Inviter:
                user.ReferralZinTokens = BigInteger.Add(BigInteger.Parse(user.ReferralZinTokens), amount).ToString();
                break;

            case BonusType.Invitee:
                user.BonusZinTokens = BigInteger.Add(BigInteger.Parse(user.BonusZinTokens), amount).ToString();
                break;
            }

            appDbContext.Users.Update(user);
            await appDbContext.SaveChangesAsync();
        }
Example #4
0
 public StatusBonus(BonusType bonusType, ModifyType modifyType, float effectValue, float effectDuration)
 {
     this.bonusType      = bonusType;
     this.modifyType     = modifyType;
     this.effectValue    = effectValue;
     this.effectDuration = effectDuration;
 }
Example #5
0
 public Bonus(Texture2D image, Vector2 position, BonusType type)
     : base(image, position)
 {
     this.AddObserver(PlayerShip.GetInstance());
     this.type = type;
     bonusTime = BONUS_15_SECONDS;
 }
Example #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Bonus")
     {
         BonusType bonusType = collision.GetComponent <Bonus>().GetBonus();
         Destroy(collision.gameObject);
         if (BonusType.HealthSupplement == bonusType)
         {
             TakeBonusHealth();
         }
         if (BonusType.SpeedIncrease == bonusType)
         {
             TakeBonusSpeed();
         }
         if (BonusType.IncreaseSize == bonusType)
         {
             TakeBonusSize();
         }
     }
     if (collision.tag == "Ball")
     {
         Rigidbody2D rigidbodyBall = collision.GetComponent <Rigidbody2D>();
         rigidbodyBall.velocity = CurrentDirection.normalized * Force;
         gameController.SetGameBonusScore();
     }
 }
Example #7
0
        public double GetBonusTypeMagnitude(BonusType bonusTypee)
        {
            double num = 0f;

            foreach (var item in this.gearList)
            {
                if (item.unlocked)
                {
                    if (item.GetbonusType() == bonusTypee)
                    {
                        num += item.GetBonusMagnitude();
                    }
                }
            }
            double num2 = 0f;

            foreach (var skill in skillList)
            {
                if (skill.isUnlocked)
                {
                    if (skill.bonusType == bonusTypee)
                    {
                        num2 += skill.magnitude;
                    }
                }
            }
            return(num + num2);
        }
Example #8
0
 public Bonus(int id_bonus, string file, int count_bonus, BonusType bonusType)
 {
     this.id_bonus    = id_bonus;
     this.file        = file;
     this.count_bonus = count_bonus;
     this.bonusType   = bonusType;
 }
Example #9
0
        public async Task UpdateAsync(BonusType bonusType)
        {
            var oldBonusType = await _bonusTypeRepository.GetBonusTypeAsync(bonusType.Type);

            if (oldBonusType == null)
            {
                throw new EntityNotFoundException($"Bonus Type with name {bonusType.Type} does not exist.");
            }

            var bonusTypeWithSameDisplayName =
                await _bonusTypeRepository.GetBonusTypeByDisplayNameAsync(bonusType.DisplayName);

            if (bonusTypeWithSameDisplayName != null && oldBonusType.Type != bonusTypeWithSameDisplayName.Type)
            {
                throw new EntityAlreadyExistsException(
                          $"Bonus Type with same Display Name '{bonusType.DisplayName}' already exists.");
            }

            // Copy old values to preserve them after update
            bonusType.CreationDate = oldBonusType.CreationDate;

            await _bonusTypeRepository.UpdateAsync(bonusType);

            _log.Info($"Bonus Type was updated: {bonusType.ToJson()}", process: nameof(UpdateAsync),
                      context: bonusType.Type);
        }
Example #10
0
    private void DuplicateCandy(GameObject go)
    {
        BonusType         goBonus  = go.GetComponent <Shape>().Bonus;
        string            goType   = go.GetComponent <Shape>().Type;
        List <GameObject> newCandy = new List <GameObject>();

        // if the candy is horizontal or vertical, add both to the list
        if ((goBonus == BonusType.Horizontal) || (goBonus == BonusType.Vertical))
        {
            newCandy.Add(GetPrefabFromTypeAndBonus(goType, BonusType.Horizontal));
            newCandy.Add(GetPrefabFromTypeAndBonus(goType, BonusType.Vertical));
        }
        else
        {
            newCandy.Add(GetPrefabFromTypeAndBonus(goType, goBonus));
        }

        foreach (var item in shapes.GetAllShapes().MatchedCandy)
        {
            if (item.GetComponent <Shape>().Type == goType)
            {
                // only replace item if the BonusType is None to not downgrade the object
                if (item.GetComponent <Shape>().Bonus == BonusType.None)
                {
                    ReplaceCandy(item, newCandy[Random.Range(0, newCandy.Count)]);
                }
            }
        }
    }
        // GET: TestAPI
        public async Task <ActionResult> GetBonusType()
        {
            WebClient client    = new WebClient();
            BonusType bonusType = await client.GetBonusType();

            return(View(bonusType));
        }
Example #12
0
    private void CreateBonus(GameObject go, MatchesInfo matchesInfo)
    {
        Shape     hitGoCache = go.GetComponent <Shape>();
        BonusType bonusType  = BonusType.None;

        if ((matchesInfo.HorizontalMatches >= Constants.MinimumMatchesForUltimate) ||
            (matchesInfo.VerticalMatches >= Constants.MinimumMatchesForUltimate))
        {
            bonusType = BonusType.Ultimate;
        }
        else if ((matchesInfo.HorizontalMatches == Constants.MinimumMatchesForBonus) &&
                 (matchesInfo.HorizontalMatches > matchesInfo.VerticalMatches))
        {
            bonusType = BonusType.Vertical;
        }
        else if ((matchesInfo.VerticalMatches == Constants.MinimumMatchesForBonus) &&
                 (matchesInfo.VerticalMatches > matchesInfo.HorizontalMatches))
        {
            bonusType = BonusType.Horizontal;
        }
        else
        {
            bonusType = BonusType.Bomb;
        }

        InstantiateAndPlaceNewCandy(hitGoCache.Row, hitGoCache.Column, GetPrefabFromTypeAndBonus(hitGoCache.Type, bonusType), bonusType);
    }
Example #13
0
    public Bonus(Vector2 pos)
        : base(pos)
    {
        // sprite.GetComponent<Renderer>().material.mainTexture = TextureLoader.GetRandomBonus();

        switch (Random.Range(0, 3)) {
            case 0 : {
                color = ColorHSV.GetColor(Random.Range(340f, 380f) % 360f, 1f, 1f);
                spriteMaterial.color = color;
                spriteMaterial.mainTexture = TextureLoader.GetHeart();
                type = BonusType.Heart;
                break;
            }
            case 1 : {
                color = ColorHSV.GetColor(Random.Range(80f, 140f), 1f, 1f);
                spriteMaterial.color = color;
                spriteMaterial.mainTexture = TextureLoader.GetClover();
                type = BonusType.Clover;
                break;
            }
            case 2 : {
                color = ColorHSV.GetColor(Random.Range(0f, 140f), 1f, 1f);
                spriteMaterial.color = color;
                spriteMaterial.mainTexture = TextureLoader.GetApple();
                type = BonusType.Apple;
                break;
            }
        }

        size = Random.Range(Grid.cellSize, Grid.cellSize * 2f);
        collisionRadius = size / 4f * Game.height;
    }
Example #14
0
    private GameObject GetPrefabFromTypeAndBonus(string type, BonusType bonusType)
    {
        List <GameObject> bonusPrefabs = new List <GameObject>();

        if (bonusType == BonusType.Ultimate)
        {
            return(Ultimate);
        }
        else if (bonusType == BonusType.Bomb)
        {
            bonusPrefabs.AddRange(BombPrefabs);
        }
        else if (bonusType == BonusType.Horizontal)
        {
            bonusPrefabs.AddRange(HorizontalPrefabs);
        }
        else if (bonusType == BonusType.Vertical)
        {
            bonusPrefabs.AddRange(VerticalPrefabs);
        }
        else if (bonusType == BonusType.None)
        {
            bonusPrefabs.AddRange(CandyPrefabs);
        }

        foreach (var item in bonusPrefabs)
        {
            if (item.GetComponent <Shape>().Type.Contains(type))
            {
                return(item);
            }
        }

        throw new System.Exception("wrong type");
    }
Example #15
0
    public float GetUnitUpgrades(UnitType unit, BonusType sType)
    {
        BonusSubject mySubject = (BonusSubject)(-1);
        BonusType    myType    = sType;

        switch (unit)
        {
        case UnitType.Swordsman:
            mySubject = BonusSubject.Melee;
            break;

        case UnitType.Archer:
            mySubject = BonusSubject.Ranged;
            break;

        case UnitType.Mage:
            mySubject = BonusSubject.Special;
            break;
        }
        if (mySubject != (BonusSubject)(-1))
        {
            return(GetBonus(mySubject, myType));
        }
        else
        {
            return(1.0f);
        }
    }
Example #16
0
        public async Task <BonusType> InsertAsync(BonusType bonusType)
        {
            bonusType.CreationDate = DateTime.UtcNow;
            bonusType.Type         = bonusType.Type.ToLower();

            var bonusTypeWithSameType = await _bonusTypeRepository.GetBonusTypeAsync(bonusType.Type);

            if (bonusTypeWithSameType != null)
            {
                throw new EntityAlreadyExistsException($"Bonus Type '{bonusType.Type}' already exists.");
            }

            var bonusTypeWithSameDisplayName =
                await _bonusTypeRepository.GetBonusTypeByDisplayNameAsync(bonusType.DisplayName);

            if (bonusTypeWithSameDisplayName != null)
            {
                throw new EntityAlreadyExistsException(
                          $"Bonus Type with same Display Name '{bonusType.DisplayName}' already exists.");
            }

            var bonusTypeResponse = await _bonusTypeRepository.InsertAsync(bonusType);

            _log.Info($"Bonus Type was added: {bonusType.ToJson()}", process: nameof(InsertAsync),
                      context: bonusType.Type);

            return(bonusTypeResponse);
        }
Example #17
0
 public GameBonus(BonusType type, int x, int y)
 {
     Type   = type;
     X      = x;
     Y      = y;
     _speed = 3;
 }
Example #18
0
        public Bonus(int x, int y, Map m, BonusType Type) : base(x, y, m)
        {
            this.Size = 20;
            bonType   = Type;

            switch (this.bonType)
            {
            case BonusType.Argent:
                Texture = TextureManager.Bonus[1];
                break;

            case BonusType.Arme:
                Texture = TextureManager.Bonus[3];
                break;

            case BonusType.Munitions:
                Texture = TextureManager.Bonus[0];
                break;

            case BonusType.Sante:
                Texture = TextureManager.Bonus[2];
                break;
            }

            EntityManager.Instance.Bonus.Add(this);
        }
Example #19
0
        public Bonus(Boolean endDoors, Vector2 pos) : base(pos)
        {
            this.label      = "Bonus";
            this.walkable   = true;
            positionSpacing = GridManager.getTextureSpacing(Game1.textureManager.bonus.First());
            this.pos        = new Vector2(pos.X + positionSpacing.X, pos.Y + positionSpacing.Y);

            if (endDoors)
            {
                this.label      = "EndDoors";
                this.bonusType  = BonusType.EndDoors;
                this.texture    = Game1.textureManager.bonus[2];
                this.bonusValue = 1;
            }
            else
            {
                switch (Randomizer.random.Next(0, 2))
                {
                case 0:
                    this.bonusType  = BonusType.BombRangeBonus;
                    this.texture    = Game1.textureManager.bonus[0];
                    this.bonusValue = 1;
                    break;

                case 1:
                    this.bonusType  = BonusType.MaxBombsPlacedBonus;
                    this.texture    = Game1.textureManager.bonus[1];
                    this.bonusValue = 1;
                    break;
                }
            }
            setupBoundingBox();
        }
Example #20
0
        public void addBonus(BonusType bonusType, Vector2 position)
        {
            int typeBonus = 0;

            switch (bonusType)
            {

                case BonusType.kill:
                    typeBonus = 1;
                    _value+= 100;

                    break;
                case BonusType.takeObject:
                    typeBonus = 2;
                    _value+= 10;

                    break;
                case BonusType.loseObject:
                    typeBonus = 3;
                    _value-= 100;

                    break;
                case BonusType.fall:
                    typeBonus = 4;
                    _value-= 10;

                    break;

            }

            _currentBonus.Add(new Bonus("kill", _currentTime, typeBonus, position));
        }
Example #21
0
 // Метод создания бонуса - ему присваиваются тип, младшая карта, а также опционно для бонусов типа "последовательность" - масть
 public Bonus(BonusType Type, CardType HighCard, bool IsTrump, CardSuit Suit = CardSuit.C_NONE)
 {
     this.Type = Type;
     this.HighCard = HighCard;
     this.Suit = Suit;
     this.IsTrump = IsTrump;
 }
Example #22
0
 public Bonus(Texture2D image, Vector2 position, BonusType type)
     : base(image, position)
 {
     this.AddObserver(PlayerShip.GetInstance());
     this.type = type;
     bonusTime = BONUS_15_SECONDS;
 }
 public static Image Shuffle()
 {
     switch (ReturnItem())
     {
         case ItemTypes.EnergyPotion:
             typePotion = PotionTypes.Energy;
             typeBonus = 0;
             return new Image("PotionsContents/energyPotion");
         case ItemTypes.Damage:
             typeBonus = BonusType.Damage;
             typePotion = 0;
             return new Image("BonusContents/boltBonus");
         case ItemTypes.Freeze:
             typeBonus = BonusType.Freeze;
             typePotion = 0;
             return new Image("BonusContents/freezBonus");
         case ItemTypes.HPPotion:
             typePotion = PotionTypes.Health;
             typeBonus = 0;
             return new Image("PotionsContents/hpPotion");
         case ItemTypes.ShieldPotion:
             typePotion = PotionTypes.Shields;
             typeBonus = 0;
             return new Image("PotionsContents/shieldPotion");
         case ItemTypes.Wind:
             typeBonus = BonusType.Wind;
             typePotion = 0;
             return new Image("BonusContents/windBonus");
         default:
             // TODO NOT WORKING PROPERLY
             throw new NotImplementedException("inccorect shuffle case !");
     }
 }
    private void OnRemoveBonus(BonusType type, Action finishCallBack)
    {
        foreach (List <PieceDO> list in _grid)
        {
            PieceDO piece = list.Find(p => p.View.HasBonus && p.View.BonusType == type);
            if (piece != null)
            {
                List <PieceDO> match = LookForMatchesToList(piece.View.Cell, piece.Type);
                piece.View.RemoveBonus(() =>
                {
                    if (finishCallBack != null)
                    {
                        finishCallBack();
                    }

                    foreach (PieceDO pieceDo in match)
                    {
                        pieceDo.Checked            = false;
                        pieceDo.Locked             = false;
                        pieceDo.View.Cell.IsMarked = false;
                        pieceDo.View.ActivateBonusBorder(false);
                    }
                });

                break;
            }
        }
    }
Example #25
0
        private void UseBonus(BonusType bonus)
        {
            switch (bonus)
            {
            case BonusType.SpeedDown:
                Barrier.DownSpeed();
                Player.DownSpeed();
                break;

            case BonusType.ExtraLive:
                Player.HealPlayer();
                break;

            case BonusType.ExtraScore:
                Score += 30;
                break;

            case BonusType.SpeedUp:
                Player.UpSpeed();
                break;

            case BonusType.ExtraBullet:
                Ammo++;
                break;

            case BonusType.None:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #26
0
        private static int ExplodeTile(int x, int y)
        {
            Vector2Int pos = new Vector2Int(x, y);

            for (int i = 0; i < _state.Characters.Count; i++)
            {
                if (_state.Characters[i].Position == pos)
                {
                    if (_state.Characters[i] == _state.Self)
                    {
                        _state.Self = null;
                    }

                    _state.Characters.RemoveAt(i);
                    i--;
                }
            }

            if (_state.GetTerrainTypeAtPos(x, y) == TerrainType.BreakableWall)
            {
                _state.Map[x, y] = TerrainType.Floor;

                if (_random.NextDouble() < GameManagerScript.Instance.Map.ItemDropProbability)
                {
                    BonusType item = (BonusType)_random.Next(2);
                    _state.Bonuses.Add(new Vector2Int(x, y), item);
                }

                return(1);
            }

            return(0);
        }
Example #27
0
 public Bonus(string name, double value, Value price, BonusType type = BonusType.Additive)
 {
     Name  = name;
     Value = value;
     Price = price;
     Type  = type;
 }
Example #28
0
 internal Equipment(EquipmentId id,
                    EquipmentClass eClass,
                    BonusType bonusType,
                    EquipmentRarity rarity,
                    double attributeBase,
                    double attributeBaseInc,
                    double attributeExp1,
                    double attributeExp2,
                    double attributeExpBase,
                    EquipmentSource source,
                    double[] _1163,
                    double[] _2095,
                    double[] _4450,
                    string fileVersion,
                    Func <string, ValueTask <Bitmap> > imageGetter = null)
 {
     Id               = id;
     Class            = eClass;
     BonusType        = bonusType;
     Rarity           = rarity;
     AttributeBase    = attributeBase;
     AttributeBaseInc = attributeBaseInc;
     AttributeExp1    = attributeExp1;
     AttributeExp2    = attributeExp2;
     AttributeExpBase = attributeExpBase;
     Source           = source;
     this._1163       = _1163;
     this._2095       = _2095;
     this._4450       = _4450;
     FileVersion      = fileVersion;
     ImageGetter      = imageGetter;
 }
 public void RemoveTimedBonus(BonusType type)
 {
     if (timed_bonus_effects.ContainsKey(type))
     {
         timed_bonus_effects.Remove(type);
     }
 }
    private int GetStatSum(PlayerController player, BonusType type)
    {
        int val = 0;

        if (type == BonusType.Att)
        {
            val = player.BattlingCard.Attack;
        }
        if (type == BonusType.Def)
        {
            val = player.BattlingCard.Defense;
        }
        if (type == BonusType.Dmg)
        {
            val = player.BattlingCard.DeckDamage;
        }

        if (bonusDB.ContainsKey(player))
        {
            foreach (BattleBonus bonus in bonusDB[player])
            {
                if (type == bonus.Type)
                {
                    val += bonus.Value;
                }
            }
        }

        return(val);
    }
Example #31
0
        public float GetBonusEffectTotal(BonusType type)
        {
            float value = 0f;

            //Equip bonus
            foreach (KeyValuePair <int, InventoryItemData> pair in character.EquipData.items)
            {
                ItemData idata = ItemData.Get(pair.Value?.item_id);
                if (idata != null)
                {
                    foreach (BonusEffectData bonus in idata.equip_bonus)
                    {
                        if (bonus.type == type)
                        {
                            value += bonus.value;
                        }
                    }
                }
            }

            //Aura bonus
            foreach (BonusAura aura in BonusAura.GetAll())
            {
                float dist = (aura.transform.position - transform.position).magnitude;
                if (aura.effect.type == type && dist < aura.range)
                {
                    value += aura.effect.value;
                }
            }

            //Timed bonus
            value += CharacterData.GetTotalTimedBonus(type);

            return(value);
        }
    IEnumerator PulseBattlingStat(PlayerController player, BonusType type)
    {
        float t = 0f;

        TextMesh mesh = null;

        if (type == BonusType.Att)
        {
            mesh = player.BattlingCard.AttText;
        }
        if (type == BonusType.Def)
        {
            mesh = player.BattlingCard.DefText;
        }
        if (type == BonusType.Dmg)
        {
            mesh = player.BattlingCard.DmgText;
        }

        while (t < 1f)
        {
            t = Mathf.MoveTowards(t, 1f, Time.deltaTime * 3f);

            float size = 1f + Mathf.Sin(Mathf.PI * t);

            mesh.transform.localScale = new Vector3(size, size, size);

            yield return(null);
        }
    }
Example #33
0
    public static void SpawnBonus(BonusType type, Vector3 position)
    {
        var prefab = Resources.Load <GameObject>("Bonus");
        var go     = GameObject.Instantiate(prefab, position, Quaternion.identity);

        go.GetComponent <Bonus>().Init(type);
    }
Example #34
0
        public void RemoveAnyBuff()
        {
            BonusType removedKey = BonusType.block_heal;
            bool      found      = false;

            foreach (var pBonus in mBonuses)
            {
                if (IsBuff(pBonus.Key))
                {
                    if (pBonus.Value.hasAny)
                    {
                        removedKey = pBonus.Key;
                        found      = true;
                        break;
                    }
                }
            }
            if (found)
            {
                PlayerBonus removedBonus = null;
                if (mBonuses.TryRemove(removedKey, out removedBonus))
                {
                    log.InfoFormat("PlayerBonuses.RemoveAnyBuff(): removed buff = {0} [yellow]", removedKey);
                    SendPropertyUpdate(false);
                }
            }
        }
Example #35
0
        public PlayerBonus GetBonus(BonusType bonus)
        {
            PlayerBonus result = null;

            bonuses.TryGetValue(bonus, out result);
            return(result);
        }
Example #36
0
 public ABonus(Bonus bonus)
 {
     Type = bonus.Type;
     X = bonus.X;
     Y = bonus.Y;
     Width = bonus.Width;
     Height = bonus.Height;
     Id = bonus.Id;
 }
Example #37
0
 /// <summary>
 /// Create an instance of barrel with a particular bonus hidden inside
 /// </summary>
 /// <param name="map">Map where this component will be placed</param>
 /// <param name="x">X-coordinate of the map position</param>
 /// <param name="y">Y-coordinate of the map position</param>
 /// <param name="textureFile">Path to the file where barrel texture is stored</param>
 /// <param name="type">Type of the bonus hidden inside the barrel</param>
 public Barrel(Map map, int x, int y, string textureFile, BonusType type)
     : this(map, x, y, textureFile)
 {
     //BonusType = type;
     switch (type)
     {
         case BonusType.Bomb: bonus = new BonusBomb(map, MapX, MapY, "Images/bonusBomb1"); break;
         case BonusType.Fire: bonus = new BonusFire(map, MapX, MapY, "Images/bonusFire1"); break;
         case BonusType.Speed: bonus = new BonusSpeed(map, MapX, MapY, "Images/bonusSpeed1"); break;
     }
 }
Example #38
0
    public void StartSlowerPuck()
    {
        if (PuckMovement.ForceOfCollisionWithPaddle - AdditionForceForPuckBonus >= MaximumForce)
        {
            Destroy(gameObject);
            return;
        }

        PuckMovement.ForceOfCollisionWithPaddle -= AdditionForceForPuckBonus;

        _currentBonusType = BonusType.SlowerPuck;
    }
Example #39
0
 /// <summary>
 /// Instanciates a new bonus object.
 /// </summary>
 /// <param name="x">The x position of the bonus element.</param>
 /// <param name="startPosition">The y start position of the bonus element.</param>
 /// <param name="speed">The speed of the bonus element.</param>
 /// <param name="bonusType">The type of bonus.</param>
 public Bonus(int x, int startPosition, double speed, BonusType bonusType)
 {
     this.x = x;
     this.y = -32;
     this.tempY = this.y;
     this.speed = speed;
     this.startPosition = startPosition;
     this.Type = bonusType;
     this.spriteSize.Height = 32;
     this.spriteSize.Width = 32;
     SetBonusSpesific();
 }
Example #40
0
 // Метод создания бонуса - ему присваиваются тип, младшая карта, а также опционно для бонусов типа "последовательность" - масть
 public Bonus(BonusType Type, CardType HighCard, bool IsTrump, CardSuit Suit = CardSuit.C_NONE)
 {
     Cards = new BaseCardList();
     this.Type = Type;
     this.HighCard = HighCard;
     this.Suit = Suit;
     this.IsTrump = IsTrump;
     Cost = CalculateCost();
     #if DEBUG
     Debug.WriteLine("{0} Создан бонус: Тип - {1}, Старшая карта - {2}, Масть - {3}, Козырь - {4}, Стоимость - {5}",
         DateTime.Now.ToString(), Type, HighCard, Suit, IsTrump, Cost);
     #endif
 }
Example #41
0
    public void StartBiggerGate()
    {
        GameObject gateObject = GameObject.Find ("Gate");
        if (gateObject.transform.localScale.x + AdditionXScaleForGate >= MaximumGateXScale)
        {
            Destroy(gameObject);
            return;
        }
        Vector3 scale = gateObject.transform.localScale;

        scale.x += AdditionXScaleForGate;

        gateObject.transform.localScale = scale;
        _currentBonusType = BonusType.BiggerGate;
    }
Example #42
0
        public Bonus()
        {
            //Bonus une Chance sur 5
            int rdmNumber1 = MyPopCorn.GlobalRnd.Next(1, 11);

            //Bonus une Chance sur 10
            int rdmNumber2 = MyPopCorn.GlobalRnd.Next(1, 21);

            //Bonus une Chance sur 100
            int rdmNumber3 = MyPopCorn.GlobalRnd.Next(1, 101);

            if (rdmNumber3 == 100)
            {
                List<BonusType> BonusTresRare = new List<BonusType>();
                BonusTresRare.Add(BonusType.PowerBall);
                BonusTresRare.Add(BonusType.Life);
                BonusTresRare.Add(BonusType.Bullets);

                int RandomIndex = MyPopCorn.GlobalRnd.Next(0, BonusTresRare.Count);

                _BonusType = BonusTresRare[RandomIndex];
            }
            else if (rdmNumber2 == 20)
            {
                List<BonusType> BonusRare = new List<BonusType>();
                BonusRare.Add(BonusType.Small);
                BonusRare.Add(BonusType.Fast);

                int RandomIndex = MyPopCorn.GlobalRnd.Next(0, BonusRare.Count);

                _BonusType = BonusRare[RandomIndex];
                //_BonusType = BonusType.Small;
            }
            else if (rdmNumber1 == 10)
            {
                List<BonusType> BonusNormaux = new List<BonusType>();
                BonusNormaux.Add(BonusType.Tall);
                BonusNormaux.Add(BonusType.Adhesive);

                int RandomIndex = MyPopCorn.GlobalRnd.Next(0, BonusNormaux.Count);

                _BonusType = BonusNormaux[RandomIndex];
            }
            else
            {
                isObsolete = true;
            }
        }
Example #43
0
 static List<int> GetBonusItems(BonusType type, int startLevel, int endLevel)
 {
     List<int> list = new List<int>();
     lock (itemsByBonus) {
         if (!itemsByBonus.ContainsKey(type))
             return list;
         var map = itemsByBonus[type];
         var submap = map.Where(entry => entry.Key >= startLevel && entry.Key < endLevel)
                         .Select(entry => entry.Value);
         if (!submap.Any())
             return list;
         foreach (List<int> itemsList in submap)
             list.AddRange(itemsList);
     }
     return list;
 }
 // Возвращает название бонуса по его типу
 public static string TextFromBonusType(BonusType bonus)
 {
     switch (bonus)
     {
         case BonusType.BONUS_100:
             return "100";
         case BonusType.BONUS_4X:
             return "4X";
         case BonusType.BONUS_50:
             return "50";
         case BonusType.BONUS_TERZ:
             return "Terz";
         default:
             return "";
     }
 }
        public LevelComponent(GameContent gameContent, World world)
        {
            this.gameContent = gameContent;
            this.world = world;

            levelData = gameContent.content.Load<LevelData>("Levels/level" + gameContent.levelIndex);

            MaxAtoms = levelData.MaxAtoms;

            int totalProbability = 0;
            for (int i = 0; i < levelData.AtomProbability.Length; i++) totalProbability += levelData.AtomProbability[i];

            if (totalProbability != 100) throw new Exception("must be 100");

            entryPoint = levelData.Entry;

            bonusType = levelData.BonusType;

            BodyDef bd = new BodyDef();
            Body ground = world.CreateBody(bd);

            PolygonShape ps = new PolygonShape();

            List<Vector2> v = levelData.ContinuousBoundry;
            for (int i = 0; i < v.Count - 1; i++)
            {
                if (v[i + 1].X == -1 && v[i + 1].Y == -1) { i++; continue; }

                ps.SetAsEdge(v[i] / gameContent.scale, v[i + 1] / gameContent.scale);
                ground.CreateFixture(ps, 0);
            }

            for (int i = 0; i < levelData.EquipmentDetails.Count; i++)
            {
                Equipment eq = new Equipment(levelData.EquipmentDetails[i].EquipmentName, gameContent, world);
                eq.body.Position = levelData.EquipmentDetails[i].Position / gameContent.scale;
                eq.body.Rotation = levelData.EquipmentDetails[i].RotationInDeg / 180 * (float)MathHelper.Pi;
                eq.isClamped = levelData.EquipmentDetails[i].IsClamped;
                eq.body.SetType(BodyType.Static);
                equipments.Add(eq);

                if (eq.equipName == EquipmentName.thermometer) thermometer = eq;

                if (eq.equipName == EquipmentName.pHscale) pHscale = eq;
            }
        }
Example #46
0
 /// <summary>
 /// Получить префаб бонуса по типу бонуса. Возвращает NULL, если для типа бонуса нету
 /// префаба.
 /// </summary>
 /// <param name="bonus">Тип бонуса.</param>
 /// <returns>Префаб бонуса. Может вернуть NULL.</returns>
 public GameObject GetPrefabBonus(BonusType bonus)
 {
     switch (bonus)
     {
         case BonusType.Expand:
             return ExpandBonus.gameObject;
         case BonusType.Divide:
             return DivideBonus.gameObject;
         case BonusType.Slow:
             return SlowBonus.gameObject;
         case BonusType.Catch:
             return CatchBonus.gameObject;
         case BonusType.Player:
             return PlayerBonus.gameObject;
     }
     return null;
 }
    public float GetBonus(BonusSubject subject, BonusType bonus)
    {
        float bonusLevel = mBonusArray[(int)subject ,(int) bonus];

        //spawn size needs to return a whole number
        if(bonus == BonusType.SpawnSize)
            return bonusLevel;

        //no bonuses purchases
        if(bonusLevel <= 0)
            return 1.0f;
        //max bonuses cap
        if(bonusLevel >= 5)
           return 2.0f;

        //each level represents 20%
        return 1 + bonusLevel * mBonusMagnitude;
    }
 public static void ExtractEffect(IShip targetShip, BonusType type)
 {
     switch (type)
     {
         case BonusType.Freeze:
             targetShip.Freeze();
             break;
         case BonusType.Damage:
             targetShip.BonusDamage();
             break;
         case BonusType.Wind:
             targetShip.Wind();
             break;
         case BonusType.Null:
             break;
         //default:
         //    throw new ArgumentOutOfRangeException(nameof(type), type, null);
     }
 }
        public Formula(int[] atomCount, int twiceNumberOfBonds, int numberOfRings, BonusType bonusType,
            Vector2 position, GameContent gameContent)
        {
            this.position = position;
            this.gameContent = gameContent;
            this.twiceNumberOfBonds = twiceNumberOfBonds;
            this.numberOfRings = numberOfRings;

            this.atomCount = new int[gameContent.symbolCount];
            atomCount.CopyTo(this.atomCount, 0);

            int bonus = 1;

            if (bonusType == BonusType.Ring)
                bonus = numberOfRings + 1;
            else if (bonusType == BonusType.Hydrogen)
                bonus = atomCount[(int)Symbol.H];

            score = twiceNumberOfBonds * bonus; strScore = "+" + twiceNumberOfBonds;
            if (bonus > 1) strScore += " x" + bonus;

            Symbol[] symbolPref = new Symbol[atomCount.Length]; // C_H_N_O_X_Ra
            symbolPref[0] = Symbol.C;
            symbolPref[1] = Symbol.H;
            symbolPref[2] = Symbol.N;
            symbolPref[3] = Symbol.O;
            symbolPref[4] = Symbol.X;
            symbolPref[5] = Symbol.Ra;

            for (int i = 0; i < symbolPref.Length; i++)
            {
                int count = atomCount[(int)symbolPref[i]];
                if (count > 0)
                {
                    strFormula += symbolPref[i];
                    if (count > 1) strFormula += count;
                }
            }

            SetPos();
        }
    public float GetUnitUpgrades(UnitType unit, BonusType sType)
    {
        BonusSubject mySubject = (BonusSubject)(-1);
        BonusType myType = sType;

        switch(unit){
        case UnitType.Swordsman:
            mySubject = BonusSubject.Melee;
            break;
        case UnitType.Archer:
            mySubject = BonusSubject.Ranged;
            break;
        case UnitType.Mage:
            mySubject = BonusSubject.Special;
            break;

        }
        if(mySubject != (BonusSubject)(-1))
            return GetBonus(mySubject, myType);
        else
            return 1.0f;
    }
Example #51
0
 public void StopBonus()
 {
     this.type = BonusType.none;
     this.bonusTime = -1;
     this.NotifyAllObservers();
 }
Example #52
0
 public ItemBonus(ItemExport exported, BonusType type)
 {
     if (type != BonusType.NONE) {
         this.type = type;
         this.typeSpecified = true;
     }
     bonusLevel = exported.suffix.ToString();
 }
Example #53
0
    public void StartSmallerGate()
    {
        GameObject gateObject = GameObject.Find ("Gate");
        if (gateObject.transform.localScale.x - AdditionXScaleForGate <= MinimumGateXScale)
        {
            Destroy(gameObject);
            return;
        }
        Vector3 scale = gateObject.transform.localScale;

        scale.x -= AdditionXScaleForGate;

        gateObject.transform.localScale = scale;
        _currentBonusType = BonusType.SmallerGate;
    }
Example #54
0
 /// <summary>
 /// Updates the timer for the bonus.
 /// </summary>
 private void UpdateTimer()
 {
     if (bonusTime > 0)
     {
         bonusTime--;
     }
     else
     {
         if (type != BonusType.none)
         {
             this.NotifyAllObservers();
         }
         type = BonusType.none;
         bonusTime = BONUS_15_SECONDS;
     }
 }
Example #55
0
 /// <summary>
 /// Updates this instance.
 /// </summary>
 public void Update()
 {
     if (this.type != BonusType.none)
     {
         if (this.type == BonusType.extraLife)
         {
             PlayerShip.GetInstance().AddLife();
             this.type = BonusType.none;
         }
         if (this.type == BonusType.extraPoints)
         {
             bonusTime = 0;
             this.NotifyAllObservers();
             this.type = BonusType.none;
         }
         UpdateTimer();
     }
 }
Example #56
0
 public Bonus(long id, double mass, double x, double y, double speedX, double speedY, double angle,
         double angularSpeed, double width, double height, BonusType type)
     : base(id, mass, x, y, speedX, speedY, angle, angularSpeed, width, height)
 {
     this.type = type;
 }
Example #57
0
 public WrappedItem()
 {
     this.type = BonusType.NONE;
     this.description = String.Empty;
 }
Example #58
0
        private int TryFindBonus(Tank self, BonusType btype, bool any = false)
        {
            int bonusId = world.Bonuses.Length;
            double maxK = 0;

            for (int i = 0; i < world.Bonuses.Length; i++)
            {
                if ((any || world.Bonuses[i].Type == btype) && IsNeed(self, world.Bonuses[i]))
                {
                    double x = world.Bonuses[i].X;
                    double y = world.Bonuses[i].Y;
                    if ((!InRect(x1, x2, y1, y2, x, y) && !Intersected(self.X, self.Y, x, y, rectX, rectY)) || CountAlive() < 4)
                    {
                        int interCount = 0;
                        Intersected(self, world.Bonuses[i], ref interCount);
                        double k = TankCoeff(self, world.Bonuses[i]);
                        double d = self.GetDistanceTo(world.Bonuses[i]);

                        if (interCount == 0 && k > maxK && (d < self.Width * 6 || CountAlive() < 3))
                        {
                            maxK = k;
                            bonusId = i;
                        }
                    }
                }
            }
            return bonusId;
        }
Example #59
0
 public Bonus(long id, double width, double height, double x, double y, BonusType type)
     : base(id, width, height, x, y, 0.0D, 0.0D, 0.0D, 0.0D)
 {
     this.type = type;
 }
Example #60
0
 public void StartDoublePack()
 {
     Instantiate (PuckObject);
     _currentBonusType = BonusType.DoublePack;
 }