Example #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("City"))
     {
         Debug.Log("Entering City");
         inCity             = true;
         currentCity        = other.gameObject.GetComponent <CityInfo>();
         aboveHeadText.text = currentCity.getName() + " Lv. " + currentCity.getLevel();
         aboveHeadText.gameObject.transform.parent.gameObject.SetActive(true);
     }
 }
Example #2
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);
            }
        }
    }