예제 #1
0
    void Awake()
    {
        Label = GetComponent <Text>();
        ValueTransfer indicator = GetComponent <ValueTransfer>();

        indicator.OnValueUpdated += OnValueUpdated;
    }
예제 #2
0
    void Start()
    {
        finalSens   = 8;
        finalVolume = 50;

        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        //Call the Gameobject
        GameObject gmobj = GameObject.FindWithTag("GM");

        //reference GameManager
        gm = gmobj.GetComponent <GameManager>();

        if (gm.restartMenu == true)
        {
            //Call the Gameobject
            GameObject temp = GameObject.FindWithTag("Transfer");

            //reference GameManager
            vt = temp.GetComponent <ValueTransfer>();

            if (sceneName == "Menu" && vt.restartValueBool == false)
            {
                sensSlider.value   = vt.senTrade / 15;
                volumeSlider.value = vt.volTrade / 100;

                gm.restartMenu      = false;
                tempRestart         = false;
                vt.restartValueBool = false;
            }
        }
        else
        {
            if (sceneName == "Menu")
            {
                sensSlider.value   = finalSens / 15;
                volumeSlider.value = finalVolume / 100;
            }
        }
        if (sceneName != "Menu")
        {
            //Call the Gameobject
            GameObject temp = GameObject.FindWithTag("Transfer");

            //reference GameManager
            vt = temp.GetComponent <ValueTransfer>();

            //putting slider values into temp values
            senTemp = vt.senTrade;
            volTemp = vt.volTrade;

            sensSlider.value   = senTemp / 15;
            volumeSlider.value = volTemp / 100;
        }
    }
예제 #3
0
    public void roundEnd()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (sceneName != "Level5")
        {
            temp = true;
            ld.randomDrop();

            //let camera free to fire
            Cursor.lockState = CursorLockMode.None;

            //switch ui
            InGameUI.SetActive(false);
            RoundWonUI.SetActive(true);

            //say loot name
            lootName.text = "Do you want the " + ld.currentWeaponName + "?";

            //switch camera to display loot
            Character.SetActive(false);
            ItemDisplay.SetActive(true);

            //stop shooting
            allowFireFinal = false;
        }
        else
        {
            //stop shooting
            allowFireFinal = false;
            Character.SetActive(false);
            //let camera free to fire
            Cursor.lockState = CursorLockMode.None;

            //Call the Gameobject
            GameObject temp = GameObject.FindWithTag("Transfer");

            //reference GameManager
            vt = temp.GetComponent <ValueTransfer>();

            //switch ui
            EndScreen.SetActive(true);
            InGameUI.SetActive(false);
            vt.VictoryCount        += 1;
            victoryCountText.text   = "You have won " + vt.VictoryCount.ToString("0") + " time(s)!!!";
            deathCountCharText.text = "You have died " + vt.CharDeathCount.ToString("0") + " time(s)!!!";

            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
    }
예제 #4
0
        public IActionResult TransferValues([FromBody] ValueTransfer transfer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            if (transfer.OriginAccount == transfer.DestinationAccount)
            {
                return(BadRequest("Origin and Destination accounts cannot be the same."));
            }

            Entry originEntry      = Entry.GetEntriesFromTransfer(transfer)[0];
            Entry destinationEntry = Entry.GetEntriesFromTransfer(transfer)[1];

            BankAccount originBankAccount = _dbContext.BankAccount.Find(transfer.OriginAccount);

            if (originBankAccount == null)
            {
                return(NotFound($"Account #{transfer.OriginAccount} does not exists."));
            }

            BankAccount destinationBankAccount = _dbContext.BankAccount.Find(transfer.DestinationAccount);

            if (destinationBankAccount == null)
            {
                return(NotFound($"Account #{transfer.DestinationAccount} does not exists."));
            }

            if (originBankAccount.UpdatedPosition - transfer.TotalAmount < 0 && !originBankAccount.AllowsOverdraft)
            {
                return(BadRequest("The origin account does not allow overdraft."));
            }
            else
            {
                originBankAccount.UpdatedPosition      = originBankAccount.UpdatedPosition - transfer.TotalAmount;
                destinationBankAccount.UpdatedPosition = destinationBankAccount.UpdatedPosition + transfer.TotalAmount;


                _dbContext.UpdateRange(originBankAccount, destinationBankAccount);

                _dbContext.AddRange(originEntry, destinationEntry);

                _dbContext.SaveChanges();

                return(Ok());
            }
        }
예제 #5
0
    void Update()
    {
        if (gm.restart == true)
        {
            tempRestart = true;
        }

        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (sceneName == "Menu" && sliderChange == true)
        {
            //Volume
            finalVolume = volumeFloat * 100;
            volume.text = finalVolume.ToString("0");

            //Sens
            finalSens = sensFloat * 15;
            Sens.text = finalSens.ToString("0");
        }
        if (sceneName != "Menu")
        {
            //Volume
            finalVolume = volumeFloat * 100;
            volume.text = finalVolume.ToString("0");

            //Sens
            finalSens = sensFloat * 15;
            Sens.text = finalSens.ToString("0");
        }

        //Call the Gameobject
        GameObject temp = GameObject.FindWithTag("Transfer");

        //reference GameManager
        vt = temp.GetComponent <ValueTransfer>();

        VictoryText.text = vt.VictoryCount.ToString("0") + " Victories";
        DeathText.text   = vt.CharDeathCount.ToString("0") + " Deaths";
    }
예제 #6
0
        public static void TestCode()
        {
            ValueTransfer vt = new ValueTransfer(1, 2, 324.67m);

            string a = vt.ToString();
        }
예제 #7
0
 void Awake()
 {
     vtransfer = GetComponent <ValueTransfer>();
     Handle    = GetComponentInChildren <SlideHandle>();
 }
예제 #8
0
 void Awake()
 {
     vtransfer = GetComponent <ValueTransfer>();
 }
예제 #9
0
 void Awake()
 {
     indicator = GetComponent <ValueTransfer>();
 }
예제 #10
0
 protected virtual void Awake()
 {
     vtransfer = GetComponent <ValueTransfer>();
     vtransfer.OnValueUpdated += OnValueUpdated;
 }
예제 #11
0
    // Update is called once per frame
    void Update()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (sceneName != "Menu" && sceneName != "tempBeginning")
        {
            level.text = "Level " + levelCount.ToString("0");
            lowRange   = 1 - (levelCount * 0.1f);
            highRange  = (6 - (levelCount - 1) - (levelCount * .1f));


            //array of enemies
            enemyArray = GameObject.FindGameObjectsWithTag("BadGuy");

            //count the array
            enemyCount = enemyArray.Length;

            //Death count, when above number of enemies on floor give loot
            deathCountText.text = enemyCount.ToString("0") + " Remaining";
            if (isDead == true && restart == false)
            {
                //Call the Gameobject
                GameObject temp = GameObject.FindWithTag("Transfer");

                //reference GameManager
                vt = temp.GetComponent <ValueTransfer>();

                vt.CharDeathCount += 1;

                pause = true;

                //let camera free to fire
                Cursor.lockState = CursorLockMode.None;

                //stop all shooting
                allowFireFinal = false;

                //switch to death screen
                InGameUI.SetActive(false);
                DeadScreen.SetActive(true);

                isDead = false;
            }
            if (Input.GetKeyDown("escape") && pause == false)
            {
                //switch ui
                OptionsMenu.SetActive(true);
                InGameUI.SetActive(false);

                //pause switch
                allowFireFinal = false;
                pause          = true;

                //pause leave
                StartCoroutine(PauseLeave());
            }
            if (pauseLeave == true && Input.GetKeyDown("escape"))
            {
                TakeActionBack();
            }
        }
    }