Ejemplo n.º 1
0
        public double Visit(Baloon baloon)
        {
            const double RHO = 0.8;
            const double G_0 = 9.80665;

            return(baloon.VolumeOfHotAir * RHO * G_0 / baloon.Mass);
        }
    void UpdateWeaponPanel()
    {
        Baloon selectedBaloon = gameController.lastSelectedBaloon;

        baloonLevel.text = selectedBaloon.GetLevel().ToString();
        baloonName.text  = selectedBaloon.GetName().ToUpper();
        //weaponPrice.text = selectedWeapon.goldCost.ToString();

        //CARICAMENTO DELL'IMMAGINE DELL'ARMA
        Sprite weaponSprite = LoadWeaponSprite(selectedBaloon.GetName(), selectedBaloon.GetAcquired());

        baloonImage.sprite = weaponSprite;
        baloonImage.rectTransform.sizeDelta = new Vector2(baloonImage.sprite.rect.width * 1.15f, baloonImage.sprite.rect.height * 1.15f);
        //weaponShadow.imageReference = weaponImage;
        if (selectedBaloon.GetAcquired())
        {
            LightRay.gameObject.SetActive(true);
        }
        else
        {
            LightRay.gameObject.SetActive(false);
        }

        weaponShadow.Adapt();
        UpdateBuyButton();
    }
Ejemplo n.º 3
0
    //METODO CHE AGGIUNGE A UN ARMA DELLA LISTA DI WEAPON UNA QUANTITA' DI CARTE
    public void AddBaloonCard(string nome, int amount)
    {
        Baloon chosenBaloon = FindBaloon(nome);

        chosenBaloon.AddToCardNumber(amount);
        Debug.Log(chosenBaloon.GetCardNumber());
    }
Ejemplo n.º 4
0
    void Start()
    {
        text = GetComponent <TextMeshProUGUI>();
        var baseBalloon = GameObject.FindGameObjectWithTag("Baloon");

        balloon        = baseBalloon.GetComponentInParent <Baloon>();
        carrtRigidbody = GameObject.Find("Platform").GetComponent <Rigidbody>();
    }
Ejemplo n.º 5
0
    private void InstantiateElement(Vector2Int gridCoordinate, int color)
    {
        Vector2 elementPos  = new Vector2(gridCoordinate.x, gridCoordinate.y);
        Baloon  gameElement = Instantiate(gameElementPrefab, elementPos, Quaternion.identity, gridTransform);

        gameElement.Init(gridCoordinate.x, gridCoordinate.y, color);
        GameManager.Instance.Grid[gridCoordinate.x, gridCoordinate.y] = gameElement;
    }
Ejemplo n.º 6
0
    void Start()
    {
        //PerlinX.SetSeed(0);
        //PerlinY.SetSeed(1);
        //PerlinZ.SetSeed(2);

        balloonRigidBody = GameObject.FindGameObjectWithTag("Baloon").GetComponentInChildren <Rigidbody>();
        baloon           = GameObject.FindObjectOfType <Baloon>();
    }
Ejemplo n.º 7
0
    private void SpawnBaloon()
    {
        float   width            = transform.GetComponent <RectTransform>().rect.width;
        float   height           = transform.GetComponent <RectTransform>().rect.height;
        Vector2 anchoredPosition = new Vector2(Random.Range(-width / 2f, width / 2f), -height / 2f - 100);
        Color   color            = colorArray[Random.Range(0, colorArray.Length)];
        Baloon  baloon           = new Baloon(pfBaloon, transform, anchoredPosition, color);

        baloonList.Add(baloon);
    }
    public void ShootBaloon(float angle, float shootDistance, Baloon baloon, Color32 color)
    {
        rigid.WakeUp();
        rigid.simulated = true;
        actualColor     = color;
        //pallincino normale
        actualBaloon = baloon;
        float adaptiveVelocity = actualBaloon.GetMaxSpeed() * shootDistance;

        rigid.velocity = new Vector2(adaptiveVelocity * Mathf.Cos(angle), adaptiveVelocity * Mathf.Sin(angle));
        launched       = true;
    }
    public void SelectBaloon(string nome)
    {
        Baloon baloonSelected = gameController.FindBaloon(nome);

        gameController.lastSelectedBaloon = baloonSelected;
        if (gameController.lastSelectedBaloon.GetAcquired() == true)
        {
            gameController.actualBaloon = baloonSelected;
        }

        UpdateWeaponPanel();
    }
Ejemplo n.º 10
0
        public async Task <IActionResult> InsertBaloon(Baloon baloon, int gameId)
        {
            var game = await _repo.GetGame(gameId);

            game.Baloons.Add(baloon);

            if (await _repo.SaveAll())
            {
                return(Ok());
            }

            return(BadRequest("You made a bad request mate."));
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var thrustToWeight = new ThrustToWeightRatio();

            var airplane = new Airplane(16000, 1250000);
            var baloon   = new Baloon(1500, 25000);
            var drone    = new Drone(7, 100, 10);

            var airplaneT2W = airplane.Accept(thrustToWeight);
            var baloonT2W   = baloon.Accept(thrustToWeight);
            var droneT2W    = drone.Accept(thrustToWeight);
        }
Ejemplo n.º 12
0
    private IEnumerator ProcessMatchesCo()
    {
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < Settings.Instance.Columns; i++)
        {
            for (int j = 0; j < Settings.Instance.Rows; j++)
            {
                Baloon currentElement = GameManager.Instance.Grid[i, j];
                if (currentElement != null)
                {
                    if (i > 0 && i < Settings.Instance.Columns - 1)
                    {
                        Baloon leftElement  = GameManager.Instance.Grid[i - 1, j];
                        Baloon rightElement = GameManager.Instance.Grid[i + 1, j];
                        if (leftElement != null && rightElement != null)
                        {
                            if (leftElement.ColorType == currentElement.ColorType && rightElement.ColorType == currentElement.ColorType)
                            {
                                List <Baloon> lineElements = new List <Baloon> {
                                    leftElement, currentElement, rightElement
                                };
                                AddBonusesToList(lineElements);
                                AddToCurrentMatches(lineElements);
                                MarkAsMatched(lineElements);
                            }
                        }
                    }

                    if (j > 0 && j < Settings.Instance.Rows - 1)
                    {
                        Baloon upElement   = GameManager.Instance.Grid[i, j + 1];
                        Baloon downElement = GameManager.Instance.Grid[i, j - 1];
                        if (upElement != null && downElement != null)
                        {
                            if (upElement.ColorType == currentElement.ColorType && downElement.ColorType == currentElement.ColorType)
                            {
                                List <Baloon> lineElements = new List <Baloon> {
                                    upElement, currentElement, downElement
                                };
                                AddBonusesToList(lineElements);
                                AddToCurrentMatches(lineElements);
                                MarkAsMatched(lineElements);
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 13
0
    void LoadSavedVariable()
    {
        //INIZIALIZZAZIONE ARMI
        foreach (Baloon b in allBaloon)
        {
            if (PlayerPrefs.GetString(b.GetName() + "acquired") == "true")
            {
                b.SetAcquired(true);
            }
            else
            {
                b.SetAcquired(false);
            }

            if (PlayerPrefs.HasKey(b.GetName() + "level"))
            {
                b.SetLevel(PlayerPrefs.GetInt(b.GetName() + "level"));
            }
            else
            {
                b.SetLevel(0);
            }

            if (PlayerPrefs.HasKey(b.GetName() + "cardNumber"))
            {
                b.SetCardNumber(PlayerPrefs.GetInt(b.GetName() + "cardNumber"));
            }
            else
            {
                b.SetCardNumber(0);
            }
        }

        //ASSEGNA L'ARMA INIZIALE SULLA BASE DI COSA HAI USATO PER ULTIMO
        if (FindBaloon(PlayerPrefs.GetString("lastUsedBaloon")) == null)
        {
            actualBaloon = FindBaloon("normal");
        }
        else
        {
            actualBaloon = FindBaloon(PlayerPrefs.GetString("lastUsedBaloon"));
        }

        lastSelectedBaloon = actualBaloon;

        //CARICA L'ULTIMA ONDATA DI NEMICI A CUI SEI ARRIVATO
        actualWave = PlayerPrefs.GetInt("actualWave");
        ChangedStats();
    }
    void CreateWeaponCard(int index, bool specialCard)
    {
        BuyableCard cardCreated = CreateCard(index);

        List <Baloon> acquiredBaloon = gameController.GetAcquiredBaloon();
        int           baloonIndex    = Random.Range(0, acquiredBaloon.Count);
        Baloon        chosenBaloon   = acquiredBaloon[baloonIndex];

        if (specialCard)
        {
            cardCreated.SetCardStats("Weapon", chosenBaloon.GetName(), "BuyableCard/Weapon/" + chosenBaloon.GetName(), Random.Range(40, 50), "gold", 5000, specialCard);
        }
        else
        {
            cardCreated.SetCardStats("Weapon", chosenBaloon.GetName(), "BuyableCard/Weapon/" + chosenBaloon.GetName(), Random.Range(8, 20), "gold", 1000, specialCard);
        }
    }
Ejemplo n.º 15
0
        public void Test_IsRendererPrintsTheGameFieldCorrectly_ShouldMatchTheStrings()
        {
            IEntity[,] entities = new IEntity[1, 1];
            Baloon baloon = new Baloon("$", new Color(ConsoleColor.White, 0));

            entities[0, 0] = baloon;
            var gameBoard = new GameBoard(entities);

            this.consoleRenderer.RenderGameBoard(gameBoard);
            this.sw.Close();
            using (StreamReader sr = new StreamReader(this.fileName))
            {
                var output = sr.ReadLine();
                Assert.AreEqual("    0 ", output);
                output = sr.ReadLine();
                Assert.AreEqual("    - ", output);
                output = sr.ReadLine();
                Assert.AreEqual("0 | $ ", output);
            }
        }
Ejemplo n.º 16
0
 public void CheckBonus()
 {
     if (GameManager.Instance.currentElement != null)
     {
         if (GameManager.Instance.currentElement.IsMatched)
         {
             GameManager.Instance.currentElement.ChangeMatchState(false);
             GameManager.Instance.currentElement.SetBonusType(BonusTypeEnum.ChangeCravityBonus);
         }
         else if (GameManager.Instance.currentElement.OtherBaloon != null)
         {
             Baloon otherDot = GameManager.Instance.currentElement.OtherBaloon;
             if (otherDot.IsMatched)
             {
                 otherDot.ChangeMatchState(false);
                 otherDot.SetBonusType(BonusTypeEnum.ChangeCravityBonus);
             }
         }
     }
 }
Ejemplo n.º 17
0
        public void Test_MoveElementDown_SholdReturnTrue()
        {
            Color   color       = new Color(ConsoleColor.Black, 1);
            IEntity fullEntity  = new Baloon("1", color);
            IEntity emptyEntity = new Baloon(".", color);

            IEntity[,] entities = new Baloon[2, 2];

            entities[0, 0] = fullEntity;
            entities[0, 1] = fullEntity;
            entities[1, 0] = emptyEntity;
            entities[1, 1] = fullEntity;

            GameBoard gameBoard = new GameBoard(entities);

            gameBoard.Drop();

            Assert.AreEqual(".", gameBoard.Entities[0, 0].Symbol);
            Assert.AreEqual("1", gameBoard.Entities[0, 1].Symbol);
            Assert.AreEqual("1", gameBoard.Entities[1, 0].Symbol);
            Assert.AreEqual("1", gameBoard.Entities[1, 1].Symbol);
        }
Ejemplo n.º 18
0
        public static Baloon[,] GenerateGameBoard(int boardHeight, int boardWidth, int maxCoulorCount)
        {
            if (boardHeight <= 0 || boardWidth <= 0 || maxCoulorCount <= 0)
            {
                throw new ApplicationException("The board size and color count must be positive number");
            }

            var    gameBoard = new Baloon[boardHeight, boardWidth];
            Baloon newBaloon;
            Color  color;

            for (int row = 0; row < boardHeight; row++)
            {
                for (int col = 0; col < boardWidth; col++)
                {
                    color               = ColorFactory.GetRandomColor(maxCoulorCount);
                    newBaloon           = new Baloon(color.ColorId.ToString(), color);
                    gameBoard[row, col] = newBaloon;
                }
            }

            return(gameBoard);
        }
Ejemplo n.º 19
0
 private bool IsBonus(Baloon element)
 {
     return(element.BonusType != BonusTypeEnum.None);
 }
Ejemplo n.º 20
0
 public bool IsColorType(Baloon ge)
 {
     return(ge.ColorType == ColorType);
 }
Ejemplo n.º 21
0
 private void Start()
 {
     baloon = gameObject.GetComponent <Baloon>();
 }
Ejemplo n.º 22
0
        protected void SendMessage(String Prefixo, String Nome, String DDD, String Telefone, String Mensagem) // Disparar envio
        {
            ImplicitWait();
            if (Telefone.Contains("-"))
            {
                Telefone = Telefone.Replace("-", String.Empty);
            }
            Nome     = Nome.Trim();
            Telefone = Telefone.Replace(" ", String.Empty);
            Telefone = DDD + Telefone;
            BaloonClick();

            if (IsElementPresent(By.XPath("/html/body/div[1]/div/div[5]/div/div/div/div/div[1]/header/a[2]/span/i")))
            {
                //"/html/body/div[1]/div/div[5]/div/div/div/div/div[1]/header/a[2]/span/i"));

                NamePT = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[8]/div/div/div[2]/form/div[1]/div[1]/div/input"));
                NamePT.SendKeys(Nome);

                CellPhone = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[8]/div/div/div[2]/form/div[1]/div[2]/div/input"));
                CellPhone.Click();
            }
            else
            {
                //Serviço Manual
                GoToManualService();

                Baloon = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[5]/div/div/div/div/div[1]/header/a[2]/span/i"));
                Baloon.Click();
                //Thread.Sleep(4000);
                //Client = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[8]/div/div/div[2]/form/div[1]/div[1]/div/input"));

                NamePT = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[5]/div/div/div/div/div[1]/header/a[3]"));
                NamePT.SendKeys(Nome);

                //Thread.Sleep(4000);

                CellPhone = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[8]/div/div/div[2]/form/div[1]/div[2]/div/input"));
                CellPhone.Click();
                //Thread.Sleep(3000);
            }
            for (int i = 0; i < Telefone.Length; i++)
            {
                CellPhone.SendKeys(Convert.ToString(Telefone[i]));
            }


            Message = Driver.FindElement(By.XPath("/html/body/div[1]/div/div[8]/div/div/div[2]/form/div[3]/div/div/textarea"));


            if (DateTime.Now.Hour >= 00 && DateTime.Now.Hour <= 11)
            {
                Message.SendKeys($"Bom dia, {Nome}, tudo bem? {Mensagem}");
            }
            else if (DateTime.Now.Hour >= 12 && DateTime.Now.Hour <= 17)
            {
                Message.SendKeys($"Boa tarde, {Nome}, tudo bem? {Mensagem}");
            }
            else if (DateTime.Now.Hour >= 18 && DateTime.Now.Hour <= 23)
            {
                Message.SendKeys($"Boa noite, {Nome}, tudo bem? {Mensagem}");
            }

            SendButton = Driver.FindElement(By.Id("btnSendMsg"));
            SendButton.Click();

            LastInfo = $"Nome: {Nome}\nTelefone: {Telefone}";
            UltimoTxt(Nome, Telefone);
            //Boolean IsOkayDisplayed = Driver.FindElement(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div/div/div/div[4]/button")).Displayed;
            //Thread.Sleep(7000);
            ///html/body/div[7]/div[2]/div/div/div/div/div/div/div Em atendimento
            while (IsElementPresent(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div")))
            {
                DialogTitle = Driver.FindElement(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div/div/div/div[3]/div/div"));
                if (DialogTitle.Text == "Aguarde, sua solicitação está sendo processada")
                {
                }
                else
                {
                    break;
                }
                System.Threading.Thread.Sleep(2000);
            }

            if (IsElementPresent(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div")))
            {
                ImplicitWait();
                DialogTitle = Driver.FindElement(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div/div/div/div[3]/div/div"));

                Relatorio(Prefixo, Nome, DDD, Telefone);
                //Pega o botão da janela de erro e clica.
                //GoToManualService();
                if (DialogTitle.Text == "Celular não encontrado")
                {
                    Driver.Navigate().GoToUrl(@"https://painel.zapsac.com/admin/atendimentos");
                    GoToManualService();
                }
                else if (DialogTitle.Text == "Esse cliente já está em atendimento pelo atendente: xxxx xxxx")
                {
                    Driver.Navigate().GoToUrl(@"https://painel.zapsac.com/admin/atendimentos");
                    CloseChat(Telefone);
                    Driver.Navigate().GoToUrl(@"https://painel.zapsac.com/admin/atendimentos");
                    GoToManualService();
                }
            }
            else if (IsElementPresent(By.XPath("/html/body/div[7]/div[2]/div/div/div/div/div/div/div/div[4]/button")) == false)
            {
                //Clica no botão de serviço manual novamente
                GoToManualService();
                CloseChat(Telefone);
                Driver.Navigate().GoToUrl(@"https://painel.zapsac.com/admin/atendimentos");
            }
        }
Ejemplo n.º 23
0
 public void Test_SetInvalidSymbolInBaloon_ShouldThrowException()
 {
     Baloon baloon = new Baloon("", color);
 }
Ejemplo n.º 24
0
 public void Test_SetInvalidColorInBaloon_ShouldThrowException()
 {
     Baloon baloon = new Baloon("a", null);
 }
Ejemplo n.º 25
0
        public void Test_CompareTwoDifferentBaloons_ShouldReturnFalse()
        {
            var newBaloon = new Baloon("y", this.color);

            Assert.AreNotEqual(newBaloon, this.firstBaloon);
        }
Ejemplo n.º 26
0
 void Start()
 {
     Camera  = GetComponentInChildren <Camera>();
     Balloon = GameObject.FindGameObjectWithTag("Baloon").GetComponentInParent <Baloon>();
 }
Ejemplo n.º 27
0
 public void OnBeginDrag(PointerEventData data)
 {
     baloon     = player.actualBaloon;
     startTouch = data.position;
     playerAnimator.SetTrigger("Charge");
 }
Ejemplo n.º 28
0
 public Damage(Baloon bloon, Player playa)
 {
     AttackBaloon  = bloon;
     DamagedPlayer = playa;
 }
Ejemplo n.º 29
0
 public void Init()
 {
     this.color        = new Color(ConsoleColor.Black, 2);
     this.firstBaloon  = new Baloon("x", color);
     this.secondBaloon = new Baloon("x", color);
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Save the previous state of the keyboard and game pad so we can determine single key/button presses
            previousGamePadState  = currentGamePadState;
            previousKeyboardState = currentKeyboardState;

            // Read the current state of the keyboard and gamepad and store it
            currentKeyboardState = Keyboard.GetState();
            currentGamePadState  = GamePad.GetState(PlayerIndex.One);

            background.Update(gameTime);
            panel.Update(gameTime);
            switch (gameState.Peek())
            {
            case _gameState.Loading:
                if (frame > 0)
                {
                    gameState.Pop();
                    gameState.Push(_gameState.Menu);
                    frame = 0;
                }
                break;

            case _gameState.Menu:
                icon.Update(gameTime);
                UpdateMenuEntities(gameTime);
                foreach (Entity val in menuEntities)
                {
                    val.Update(gameTime);
                }
                if (frame > 30)
                {
                    if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed ||
                        Keyboard.GetState().IsKeyDown(Keys.Escape))
                    {
                        gameState.Pop();
                        gameState.Push(_gameState.Exit);
                        frame = 0;
                    }
                    else if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed ||
                             Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        gameState.Push(_gameState.Playing);
                        frame = 0;
                    }
                }
                break;

            case _gameState.Playing:
                //Update the player
                UpdatePlayer(gameTime);
                player.Update(gameTime);

                //Update entities
                UpdateEntities(gameTime);
                foreach (Entity val in entities)
                {
                    val.Update(gameTime);
                }

                //Baloons
                if (frame / 1200 == 1 && frame % 1200 == 0)
                {
                    BaloonBonus = new Baloon();
                    switch (rnd.Next(0, 4))
                    {
                    case 0:
                        BaloonBonus.Initialize(redBaloonAnimation, new Vector2(rnd.Next(0, 500), 500 + redBaloonAnimation.FrameHeight), 4f, Baloon.BaloonColor.red);
                        break;

                    case 1:
                        BaloonBonus.Initialize(blueBaloonAnimation, new Vector2(rnd.Next(0, 500), 500 + blueBaloonAnimation.FrameHeight), 4f, Baloon.BaloonColor.blue);
                        break;

                    case 2:
                        BaloonBonus.Initialize(greenBaloonAnimation, new Vector2(rnd.Next(0, 500), 500 + greenBaloonAnimation.FrameHeight), 4f, Baloon.BaloonColor.green);
                        break;

                    case 3:
                        BaloonBonus.Initialize(yellowBaloonAnimation, new Vector2(rnd.Next(0, 500), 500 + yellowBaloonAnimation.FrameHeight), 4f, Baloon.BaloonColor.yellow);
                        break;

                    default:
                        break;
                    }
                    entities.Add(BaloonBonus);
                }
                if (frame / 1200 == 2 && frame % 1200 == 0)
                {
                    instaKill = false;
                    killBonus = false;
                    zoneShot  = false;
                }

                UpdateShoots(gameTime);

                //Exit
                if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed ||
                    Keyboard.GetState().IsKeyDown(Keys.Escape))
                {
                    gameState.Pop();
                    frame = 0;
                }
                break;

            case _gameState.Options:

                break;

            case _gameState.Exit:
                if (frame > 180)
                {
                    gameState.Pop();
                    Exit();
                }
                break;

            default:
                gameState.Push(_gameState.Loading);
                break;
            }
            base.Update(gameTime);
            frame++;
        }