Beispiel #1
0
    // Update is called once per frame

    void Update()
    {
        switch (buttonID)
        {
        case 0:
            if (InputManager.Abutton())
            {
                timer           = 0.5f;
                buttonImg.color = new Color32(105, 105, 105, 255);
            }
            break;

        case 1:
            if (InputManager.Bbutton())
            {
                timer           = 0.5f;
                buttonImg.color = new Color32(105, 105, 105, 255);
            }
            break;

        case 2:
            if (InputManager.Ybutton())
            {
                timer           = 0.5f;
                buttonImg.color = new Color32(105, 105, 105, 255);
            }
            break;

        case 3:
            if (InputManager.Xbutton())
            {
                timer           = 0.5f;
                buttonImg.color = new Color32(105, 105, 105, 255);
            }
            break;
        }

        if (timer > 0)
        {
            buttonImg.color = new Color(buttonImg.color.r + (1 * Time.deltaTime), buttonImg.color.g + (1 * Time.deltaTime), buttonImg.color.b + (1 * Time.deltaTime), 255);
            timer          -= 1 * Time.deltaTime;
            if (timer <= 0)
            {
                buttonImg.color = new Color32(255, 255, 255, 255);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (!activeBattle && !startingBattle)
        {
            overworldUI.SetActive(true);
        }
        else
        {
            overworldUI.SetActive(false);
        }

        if (activeBattle)
        {
            battleUI.SetActive(true);
            targetTimer -= 1f * Time.deltaTime;
            if (targetTimer <= 0f)
            {
                if (InputManager.MainHorizontal() > 0.2f)
                {
                    target--;
                    targetTimer = 0.5f;
                    if (target < 0)
                    {
                        target = enemies.Count - 1;
                    }
                    Debug.Log(target);
                }
                else if (InputManager.MainHorizontal() < -0.2f)
                {
                    target++;
                    targetTimer = 0.5f;
                    if (target >= enemies.Count)
                    {
                        target = 0;
                    }
                    Debug.Log(target);
                }
            }

            TargetUI.text = "Target: " + target;

            if (NeedInput())
            {
                abilityUI.gameObject.SetActive(true);
                abilityUI.SetPos(activePlayer);
                abilityUI.SetAbilities(abilityList[players[activePlayer].getAbility(0)].getname(), abilityList[players[activePlayer].getAbility(1)].getname(),
                                       abilityList[players[activePlayer].getAbility(2)].getname(), abilityList[players[activePlayer].getAbility(3)].getname());



                List <Fighter> tempAOE = new List <Fighter>();
                for (int i = 0; i < players.Count; i++)
                {
                    tempAOE.Add(players[i]);
                }

                if (InputManager.Abutton())
                {
                    if (!abilityList[players[activePlayer].getAbility(0)].getAOE())
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(0)], players[activePlayer], enemies[target]);
                    }
                    else
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(0)], players[activePlayer], tempAOE);
                    }
                }
                else if (InputManager.Bbutton())
                {
                    if (!abilityList[players[activePlayer].getAbility(1)].getAOE())
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(1)], players[activePlayer], enemies[target]);
                    }
                    else
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(1)], players[activePlayer], tempAOE);
                    }
                }
                else if (InputManager.Ybutton())
                {
                    if (!abilityList[players[activePlayer].getAbility(2)].getAOE())
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(2)], players[activePlayer], enemies[target]);
                    }
                    else
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(2)], players[activePlayer], tempAOE);
                    }
                }
                else if (InputManager.Xbutton())
                {
                    if (!abilityList[players[activePlayer].getAbility(3)].getAOE())
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(3)], players[activePlayer], enemies[target]);
                    }
                    else
                    {
                        currentAction = new Action(abilityList[players[activePlayer].getAbility(3)], players[activePlayer], tempAOE);
                    }
                }
            }
            else
            {
                abilityUI.gameObject.SetActive(false);
            }
        }
        else
        {
            battleUI.SetActive(false);
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log(Input.GetAxis("J_MainVertical"));
        //Debug.Log(InputManager.MainVertical());
        int level = battler.getPlayerlevel();

        LevelUI.text      = "Party Level: " + level;
        ExpUI.text        = "Expereince: " + battler.getPlayerEXP();
        ExpToLevelUI.text = "Exp to level: " + ((level * level) * 100);
        GoldUI.text       = "Gold: " + gold;
        GearUI.text       = "Gear Level: " + battler.getPlayerGear();
        if (!battler.activeBattle && !battler.startingBattle && !inMenu)
        {
            if (Mathf.Abs(InputManager.MainHorizontal()) > 0.2f || Mathf.Abs(InputManager.MainVertical()) > 0.2f)
            {
                transform.position += InputManager.MainJoystick() * Time.deltaTime * movementSpeed;
                transform.rotation  = Quaternion.LookRotation(InputManager.MainJoystick());
                float distanceTraveled = InputManager.MainJoystick().magnitude *Time.deltaTime *movementSpeed;
                battler.AddDistance(distanceTraveled);
            }
            if (inCity)
            {
                if (InputManager.Abutton())
                {
                    inMenu = true;
                    CityMenu.SetActive(true);
                }
            }
        }
        if (inMenu)
        {
            int upgradeCost = 200 + (200 * battler.getPlayerGear());
            //UpgradeCostUI.text = "Upgrade Gear: "+upgradeCost+"g";
            aboveHeadText.gameObject.transform.parent.gameObject.SetActive(false);
            if (InputManager.Bbutton())
            {
                inMenu = false;
                CityMenu.SetActive(false);
            }
            if (InputManager.Ybutton())
            {
                if (gold >= 50)
                {
                    battler.levelUp();
                    gold -= 50;
                }
            }
            if (InputManager.Xbutton())
            {
                if (gold >= upgradeCost && battler.getPlayerGear() < currentCity.getLevel())
                {
                    battler.upgradeGear();
                    gold -= upgradeCost;
                }
            }
        }
        else
        {
            CityMenu.SetActive(false);
            if (inCity)
            {
                aboveHeadText.gameObject.transform.parent.gameObject.SetActive(true);
            }
        }
    }