Пример #1
0
        /// <summary>
        /// ぼかし更新
        /// </summary>
        private void UpdateBlurRate()
        {
            if (ui.IsEnd())
            {
                blurRate -= 0.05f;
                blurEffect.Update(blurRate);
                return;
            }

            if (blurRate < 0.6f)
            {
                blurRate += 0.05f;
            }

            blurEffect.Update(blurRate);
        }
Пример #2
0
        public void Update(GameTime gameTime)
        {
            guildUI.Update();

            UpdateBlurRate();
            blurEffect.Update(blurRate);

            CheckEnd();
        }
Пример #3
0
        public void Update(GameTime gameTime)
        {
            UpdateBlurRate();
            blurEffect.Update(blurRate);

            leftWindow.Update();
            rightWindow.Update();
            messegeWindow.Update();
            equipmentWindow.Update();
            consumptionWindow.Update();

            rightPageRightWindow.Update();
            rightPageLeftWindow.Update();
            leftPageRightWindow.Update();
            leftPageLeftWindow.Update();

            foreach (Window w in leftWindows)
            {
                w.Update();
            }
            foreach (Window w in rightWindows)
            {
                w.Update();
            }

            backWindow.Update();

            Point mousePos = new Point(
                (int)input.GetMousePosition().X,
                (int)input.GetMousePosition().Y);

            if (!backWindow.CurrentState() && !endFlag)
            {
                backWindow.Switch();
            }

            //セレクト処理
            if (mode == DepotModeType.select)
            {
                if (!messegeWindow.CurrentState())
                {
                    messegeWindow.Switch();
                }
                if (!equipmentWindow.CurrentState())
                {
                    equipmentWindow.Switch();
                }
                if (!consumptionWindow.CurrentState())
                {
                    consumptionWindow.Switch();
                }
                if (leftWindow.CurrentState())
                {
                    leftWindow.Switch();
                }
                if (rightWindow.CurrentState())
                {
                    rightWindow.Switch();
                }

                if (equipmentButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode = DepotModeType.equipment;
                    EquipmentModeInitialize();
                    return;
                }

                if (consumptionButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode = DepotModeType.consumption;
                    ConsumptionModeInitialize();
                    return;
                }
                if (backButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode    = DepotModeType.end;
                    endFlag = true;
                }

                if (leftPageLeftWindow.CurrentState())
                {
                    leftPageLeftWindow.Switch();
                }
                if (leftPageRightWindow.CurrentState())
                {
                    leftPageRightWindow.Switch();
                }
                if (rightPageLeftWindow.CurrentState())
                {
                    rightPageLeftWindow.Switch();
                }
                if (rightPageRightWindow.CurrentState())
                {
                    rightPageRightWindow.Switch();
                }
                return;
            }
            else if (mode != DepotModeType.end) //セレクト外共通処理
            {
                if (messegeWindow.CurrentState())
                {
                    messegeWindow.Switch();
                }
                if (equipmentWindow.CurrentState())
                {
                    equipmentWindow.Switch();
                }
                if (consumptionWindow.CurrentState())
                {
                    consumptionWindow.Switch();
                }
                if (!leftWindow.CurrentState())
                {
                    leftWindow.Switch();
                }
                if (!rightWindow.CurrentState())
                {
                    rightWindow.Switch();
                }

                inventory.BagItemCount(ref bagNowNum, ref bagMaxNum);
                inventory.DepositoryEquipCount(ref depotNowNum, ref depotMaxNum);

                //ページ関連
                if (leftPage > leftMaxPage)
                {
                    leftPage = leftMaxPage;
                    LeftPage(leftPage);
                }
                if (rightPage > rightMaxPage)
                {
                    rightPage = rightMaxPage;
                    RightPage(rightPage);
                }
                //左側
                if (leftPage > 1)
                {
                    if (!leftPageLeftWindow.CurrentState())
                    {
                        leftPageLeftWindow.Switch();
                    }
                    if (leftPageLeftButton.IsClick(mousePos) && input.IsLeftClick())
                    {
                        leftPage--;
                        LeftPage(leftPage);
                    }
                }
                else
                {
                    if (leftPageLeftWindow.CurrentState())
                    {
                        leftPageLeftWindow.Switch(); //消す
                    }
                }
                if (leftPage < leftMaxPage)
                {
                    if (!leftPageRightWindow.CurrentState())
                    {
                        leftPageRightWindow.Switch();
                    }
                    if (leftPageRightButton.IsClick(mousePos) && input.IsLeftClick())
                    {
                        leftPage++;
                        LeftPage(leftPage);
                    }
                }
                else
                {
                    if (leftPageRightWindow.CurrentState())
                    {
                        leftPageRightWindow.Switch(); //消す
                    }
                }
                //右側
                if (rightPage > 1)
                {
                    if (!rightPageLeftWindow.CurrentState())
                    {
                        rightPageLeftWindow.Switch();
                    }
                    if (rightPageLeftButton.IsClick(mousePos) && input.IsLeftClick())
                    {
                        rightPage--;
                        RightPage(rightPage);
                    }
                }
                else
                {
                    if (rightPageLeftWindow.CurrentState())
                    {
                        rightPageLeftWindow.Switch(); //消す
                    }
                }
                if (rightPage < rightMaxPage)
                {
                    if (!rightPageRightWindow.CurrentState())
                    {
                        rightPageRightWindow.Switch();
                    }
                    if (rightPageRightButton.IsClick(mousePos) && input.IsLeftClick())
                    {
                        rightPage++;
                        RightPage(rightPage);
                    }
                }
                else
                {
                    if (rightPageRightWindow.CurrentState())
                    {
                        rightPageRightWindow.Switch(); //消す
                    }
                }

                isHintDraw = false;
                if (input.GetMousePosition().X + 35 + 416 > windowWidth)
                {
                    hintInfo.Position = new Vector2(windowWidth - 416, input.GetMousePosition().Y + 50);
                }
                else
                {
                    hintInfo.Position = input.GetMousePosition() + new Vector2(35, 50);
                }

                //メッセージ関連
                isBagMax        = false;
                isBagMaxMessaga = false;
                if (bagNowNum >= bagMaxNum)
                {
                    isBagMax = true;
                }
                foreach (Button b in rightButtons)
                {
                    if (b.IsClick(mousePos) && isBagMax)
                    {
                        isBagMaxMessaga = true;
                    }
                }

                isDepotMax        = false;
                isDepotMaxMessaga = false;
                if (depotNowNum >= depotMaxNum)
                {
                    isDepotMax = true;
                }
                foreach (Button b in leftButtons)
                {
                    if (b.IsClick(mousePos) && isDepotMax)
                    {
                        isDepotMaxMessaga = true;
                    }
                }

                //戻るボタン
                if (backButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode = DepotModeType.select;
                }
            }

            //装備品
            if (mode == DepotModeType.equipment)
            {
                playerItems = inventory.BagList();
                leftItems   = new List <Item>();
                foreach (Item i in playerItems)
                {
                    if (i is WeaponItem || i is ProtectionItem || i is AccessaryItem)
                    {
                        leftItems.Add(i);
                    }
                }

                rightItems = new List <Item>();
                equipments = inventory.EquipDepository();
                foreach (Item i in equipments)
                {
                    rightItems.Add(i);
                }

                //バッグ側
                for (int i = 0; i < leftButtons.Count; i++)
                {
                    if (leftButtons[i].IsClick(mousePos))
                    {
                        isHintDraw = true;
                        hintItem   = leftPageItems[i];

                        if (input.IsLeftClick() && !isDepotMax)
                        {
                            if (rightPageItems.Count < 20)
                            {
                                AddRightList(leftItems[i + (leftPage - 1) * 20]);
                            }
                            inventory.DepositEquip(inventory.BagItemIndex(leftItems[i + (leftPage - 1) * 20]));
                            rightItems.Add(leftItems[i + (leftPage - 1) * 20]);
                            RemoveLeftList(i);

                            leftMaxPage  = (leftItems.Count - 1) / 20 + 1;
                            rightMaxPage = (rightItems.Count - 1) / 20 + 1;
                        }
                    }
                }

                //倉庫側
                for (int i = 0; i < rightButtons.Count; i++)
                {
                    if (rightButtons[i].IsClick(mousePos))
                    {
                        isHintDraw = true;
                        hintItem   = rightPageItems[i];

                        if (input.IsLeftClick() && !isDepotMax)
                        {
                            if (leftPageItems.Count < 20)
                            {
                                AddLeftList(rightItems[i + (rightPage - 1) * 20]);
                            }
                            inventory.MoveDepositEquipToBag(inventory.DepositEquipIndex(rightItems[i + (rightPage - 1) * 20]));
                            RemoveRightList(i);

                            leftMaxPage  = (leftItems.Count - 1) / 20 + 1;
                            rightMaxPage = (rightItems.Count - 1) / 20 + 1;
                        }
                    }
                }
            }

            //消費アイテム
            if (mode == DepotModeType.consumption)
            {
                playerItems = inventory.BagList();
                leftItems   = new List <Item>();
                foreach (Item item in playerItems)
                {
                    if (item is ConsumptionItem)
                    {
                        leftItems.Add(item);
                    }
                }

                consumptions = inventory.DepositoryItem();
                rightItems   = new List <Item>();
                foreach (int id in consumptions.Keys)
                {
                    rightItems.Add(itemManager.GetConsumption(id));
                }

                //バッグ側
                for (int i = 0; i < leftButtons.Count; i++)
                {
                    if (leftButtons[i].IsClick(mousePos))
                    {
                        isHintDraw = true;
                        hintItem   = leftPageItems[i];

                        if (input.IsLeftClick())
                        {
                            inventory.DepositItem(inventory.BagItemIndex(leftItems[i + (leftPage - 1) * 20]));
                            if (consumptions[leftItems[i + (leftPage - 1) * 20].GetItemID()] - 1 * ((ConsumptionItem)leftItems[i + (leftPage - 1) * 20]).GetStack() <= 0)
                            {
                                if (rightPageItems.Count < 20)
                                {
                                    AddRightList(leftItems[i + (leftPage - 1) * 20]);
                                }
                            }
                            rightItems.Add(leftItems[i + (leftPage - 1) * 20]);
                            RemoveLeftList(i);

                            leftMaxPage  = (leftItems.Count - 1) / 20 + 1;
                            rightMaxPage = (rightItems.Count - 1) / 20 + 1;
                        }
                    }
                }

                //倉庫側
                for (int i = 0; i < rightButtons.Count; i++)
                {
                    if (rightButtons[i].IsClick(mousePos))
                    {
                        isHintDraw = true;
                        hintItem   = rightPageItems[i];

                        if (input.IsLeftClick())
                        {
                            if (consumptions[rightItems[i + (rightPage - 1) * 20].GetItemID()] - 1 <= 0)
                            {
                                inventory.MoveDepositItemToBag(itemManager, rightItems[i + (rightPage - 1) * 20].GetItemID());
                                RemoveRightList(i + (rightPage - 1));
                            }
                            else
                            {
                                inventory.MoveDepositItemToBag(itemManager, rightItems[i + (rightPage - 1) * 20].GetItemID());
                            }

                            playerItems = inventory.BagList();
                            leftItems   = new List <Item>();
                            foreach (Item item in playerItems)
                            {
                                if (item is ConsumptionItem)
                                {
                                    leftItems.Add(item);
                                }
                            }
                            LeftPage(leftPage);

                            leftMaxPage  = (leftItems.Count - 1) / 20 + 1;
                            rightMaxPage = (rightItems.Count - 1) / 20 + 1;
                        }
                    }
                }
            }
        }
Пример #4
0
        public void Update(GameTime gameTime)
        {
            store.Update();

            leftWindow.Update();
            rightWindow.Update();
            messegeWindow.Update();
            buyWindow.Update();
            sellWindow.Update();

            Point mousePos = new Point(
                (int)input.GetMousePosition().X,
                (int)input.GetMousePosition().Y);

            if (mode == ShopMode.select)
            {
                if (backRect.Contains(mousePos) && input.IsLeftClick())
                {
                    endFlag = true;
                }

                if (!isMessegePop)
                {
                    messegeWindow.Switch();
                    buyWindow.Switch();
                    sellWindow.Switch();
                    isMessegePop = true;
                }
                if (buyButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode = ShopMode.buy;
                    store.Initialize();
                    store.Buy();
                    messegeWindow.Switch();
                    buyWindow.Switch();
                    sellWindow.Switch();
                    isMessegePop = false;
                }
                else if (sellButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    mode = ShopMode.sell;
                    store.Initialize();
                    store.Sell();
                    messegeWindow.Switch();
                    buyWindow.Switch();
                    sellWindow.Switch();
                    isMessegePop = false;
                }
            }
            else
            {
                if (!isPop)
                {
                    leftWindow.Switch();
                    rightWindow.Switch();
                    isPop = true;
                }

                if (backRect.Contains(mousePos) && input.IsLeftClick())
                {
                    mode = ShopMode.select;
                    leftWindow.Switch();
                    rightWindow.Switch();
                    isPop = false;
                }
            }

            UpdateBlurRate();
            blurEffect.Update(blurRate);
        }
Пример #5
0
    // Update is called once per frame
    //Split update into smaller methods later.
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            SceneManager.LoadScene("MainMenu");
        }

        deathModifier += Time.deltaTime / 100;
        aDoubleTap.Update();
        bDoubleTap.Update();
        shield.Update();
        blur.Update();
        speedometer.Update();

        if (dropDown)
        {
            DropDown();
            return;
        }

        //death
        if (Mathf.Abs(rb.velocity.z) < deathTresholdCity * deathModifier && desertMode == false)
        {
        }
        else if (Mathf.Abs(rb.velocity.z) < deathTresholdDesert * deathModifier && desertMode == true)
        {
        }
        else
        {
            deathStart = Time.time;
        }

        if (deathStart + 2 < Time.time && readyToDie)
        {
            GameObject.Find("FadeOut").GetComponent <FadeOut>().StartFadeOut();
        }

        //If behind portal
        if (desertMode && portalDesertSpawner.exitPortal != null)
        {
            if (transform.position.z < portalDesertSpawner.newEntracePortalPosition.z - 1000)
            {
                Destroy(gameObject);
            }
        }

        score += (int)(Mathf.Abs(rb.velocity.z) * Time.deltaTime);

        //Get data from UDPRecieve script for X value of acceleromter on app
        float.TryParse(UDPReceive.lastReceivedUDPPacket, out accelData);
        //Debug.Log(accelData);

        //Accelerate the car initally.
        if (rb.velocity.z > -4000)
        {
            rb.AddRelativeForce(Vector3.forward * -1000 * Time.deltaTime * 50);
        }

        //Accelerate car continuously;
        rb.AddRelativeForce(Vector3.forward * -100 * Time.deltaTime * 50);

        //Calculate bonus horizontal speed.
        bonusHorizontalSpeed = CalculateBonusHorizontalSpeed();

        //Lerp back the boost horizontal speed to 0.
        boostHorizontalSpeed = Mathf.Lerp(boostHorizontalSpeed, 0, Time.deltaTime / 0.1f);

        //Input keyboard code.
        if (accelData > 0.19)
        {
            currentHorizontalSpeed = Mathf.Lerp(currentHorizontalSpeed, (accelData * 10000) * -1 + -bonusHorizontalSpeed + -boostHorizontalSpeed, Time.deltaTime / 0.2f);
        }

        if (accelData < -0.19)
        {
            currentHorizontalSpeed = Mathf.Lerp(currentHorizontalSpeed, (accelData * 10000) * -1 + bonusHorizontalSpeed + boostHorizontalSpeed, Time.deltaTime / 0.2f);
        }

        if (Input.GetKey(KeyCode.D))
        {
            currentHorizontalSpeed = Mathf.Lerp(currentHorizontalSpeed, -maxHorizontalSpeed + -bonusHorizontalSpeed + -boostHorizontalSpeed, Time.deltaTime / 0.2f);
        }

        if (Input.GetKey(KeyCode.A))
        {
            currentHorizontalSpeed = Mathf.Lerp(currentHorizontalSpeed, maxHorizontalSpeed + bonusHorizontalSpeed + boostHorizontalSpeed, Time.deltaTime / 0.2f);
        }

        //If none of the buttons are pressed, lerp to 0 on horizontal speed.
        if (!Input.GetKey(KeyCode.D) && !Input.GetKey(KeyCode.A))
        {
            currentHorizontalSpeed = Mathf.Lerp(currentHorizontalSpeed, 0, Time.deltaTime / 0.1f);
        }


        //Check lane boundaries
        if (transform.position.x < -3800 && !desertMode)
        {
            transform.position     = new Vector3(-3800, transform.position.y, transform.position.z);
            currentHorizontalSpeed = 0;
        }

        if (transform.position.x > -630 && !desertMode)
        {
            transform.position     = new Vector3(-630, transform.position.y, transform.position.z);
            currentHorizontalSpeed = 0;
        }

        //tilt
        //Mb turn more the more ur speed is
        Vector3 rotation = transform.localRotation.eulerAngles;
        float   maxYTilt = Helper.Remap(rb.velocity.z, minimumSpeed, -16000, 20, 40);

        maxYTilt   = Mathf.Clamp(maxYTilt, -40, 40);
        rotation.y = Helper.Remap(currentHorizontalSpeed, (-maxHorizontalSpeed + -bonusHorizontalSpeed + -boostHorizontalSpeed) * -1, -maxHorizontalSpeed + -bonusHorizontalSpeed + -boostHorizontalSpeed, -maxYTilt, maxYTilt);
        rotation.z = Helper.Remap(currentHorizontalSpeed, (-maxHorizontalSpeed + -bonusHorizontalSpeed + -boostHorizontalSpeed) * -1, -maxHorizontalSpeed + -bonusHorizontalSpeed + -boostHorizontalSpeed, -7, 7);
        transform.localRotation = Quaternion.Euler(rotation);

        rb.velocity = new Vector3(currentHorizontalSpeed, rb.velocity.y, rb.velocity.z);

        //Set speed to minimum if less than minimum.
        if (rb.velocity.z > minimumSpeed)   //Remember, the minimum speed is negative.
        {
            rb.velocity = new Vector3(rb.velocity.x, rb.velocity.y, minimumSpeed);
        }
        //Debug.Log(currentHorizontalSpeed);
        //Wheel smoke
        if (Mathf.Abs(currentHorizontalSpeed) > 1000)
        {
            foreach (GameObject wheel in wheelSmoke)
            {
                wheel.GetComponent <ParticleSystem>().Play();
            }
        }
        else
        {
            foreach (GameObject wheel in wheelSmoke)
            {
                wheel.GetComponent <ParticleSystem>().Stop();
            }
        }

        _UpdateText();
    }
Пример #6
0
        public void Update(GameTime gameTime)
        {
            UpdateBlurRate();
            blurEffect.Update(blurRate);

            leftWindow.Update();
            rightWindow.Update();
            messegeWindow.Update();
            backWindow.Update();
            upgradeWindow.Update();
            foreach (Window w in leftWindows)
            {
                w.Update();
            }
            if (isNotEnoughMessage || isNoMoneyMessage || isBiggestMessage)
            {
                if (!messegeWindow.CurrentState())
                {
                    messegeWindow.Switch();
                }
            }
            else if (!isNotEnoughMessage && !isNoMoneyMessage && !isBiggestMessage)
            {
                if (messegeWindow.CurrentState())
                {
                    messegeWindow.Switch();
                }
            }

            isNotEnoughMessage = false;
            isNoMoneyMessage   = false;
            isBiggestMessage   = false;

            Point mousePos = new Point(
                (int)input.GetMousePosition().X,
                (int)input.GetMousePosition().Y);

            if (isSelect && !rightWindow.CurrentState())
            {
                rightWindow.Switch();
            }
            if (!upgradeWindow.CurrentState())
            {
                upgradeWindow.Switch();
            }
            if (!backWindow.CurrentState())
            {
                backWindow.Switch();
            }
            if (isSelect)
            {
                if (!upgradeWindow.CurrentState())
                {
                    upgradeWindow.Switch();
                }
            }
            else
            {
                if (upgradeWindow.CurrentState())
                {
                    upgradeWindow.Switch();
                }
            }

            leftPageRightWindow.Update();
            leftPageLeftWindow.Update();

            //ページ関連
            if (leftPage > leftMaxPage)
            {
                leftPage = leftMaxPage;
                LeftPage(leftPage);
            }
            //左側
            if (leftPage > 1)
            {
                if (!leftPageLeftWindow.CurrentState())
                {
                    leftPageLeftWindow.Switch();
                }
                if (leftPageLeftButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    leftPage--;
                    LeftPage(leftPage);
                }
            }
            else
            {
                if (leftPageLeftWindow.CurrentState())
                {
                    leftPageLeftWindow.Switch(); //消す
                }
            }
            if (leftPage < leftMaxPage)
            {
                if (!leftPageRightWindow.CurrentState())
                {
                    leftPageRightWindow.Switch();
                }
                if (leftPageRightButton.IsClick(mousePos) && input.IsLeftClick())
                {
                    leftPage++;
                    LeftPage(leftPage);
                }
            }
            else
            {
                if (leftPageRightWindow.CurrentState())
                {
                    leftPageRightWindow.Switch(); //消す
                }
            }

            if (backButton.IsClick(mousePos) && input.IsLeftClick())
            {
                endFlag = true;
            }

            for (int i = 0; i < leftButtons.Count; i++)
            {
                if (leftButtons[i].IsClick(mousePos) && input.IsLeftClick())
                {
                    SetItem(leftItems[i + (leftPage - 1) * 20]);
                }
            }

            playerItems = inventory.BagList();
            leftItems   = new List <Item>();
            foreach (Item i in playerItems)
            {
                if (i is WeaponItem || i is ProtectionItem)
                {
                    leftItems.Add(i);
                }
            }

            if (isSelect && !isBiggest)
            {
                //お金が足りているか
                if (myMoney >= useMoney)
                {
                    isMoney = true;
                }
                else
                {
                    isMoney = false;
                }


                //素材が足りているかどうか
                foreach (int id in materialItems.Keys)
                {
                    if (consumptions.Keys.Contains(id))
                    {
                        if (consumptions[id] >= materialItems[id])
                        {
                            isEnough = true;
                        }
                        else
                        {
                            isEnough = false;
                            break;
                        }
                    }
                    else
                    {
                        isEnough = false;
                        break;
                    }
                }
            }

            //強化ボタン
            if (upgradeButton.IsClick(mousePos) && isSelect)
            {
                if (!isEnough)
                {
                    isNotEnoughMessage = true;
                }
                if (!isMoney)
                {
                    isNoMoneyMessage = true;
                }
                if (isBiggest)
                {
                    isBiggestMessage = true;
                }
                if (isEnough && isMoney && !isBiggest)
                {
                    if (input.IsLeftClick())
                    {
                        inventory.SpendMoney(useMoney);
                        if (selectItem is WeaponItem)
                        {
                            ((WeaponItem)selectItem).LevelUp();
                        }
                        else
                        {
                            ((ProtectionItem)selectItem).LevelUp();
                        }
                        foreach (int id in materialItems.Keys)
                        {
                            RemoveItem(id, materialItems[id]);
                        }
                        Reset();
                    }
                }
            }
        }