Money system.cd Author: Kevin Harris handles money process money either adds or subtracts money for the user depending on if pus or minus is added
상속: MonoBehaviour
예제 #1
0
	void Start () {
		if (sys == null)
			sys = this;
		else if (sys != this)
			Destroy(gameObject);
		OnChange += RefreshMoney;
	}
예제 #2
0
    //Money = GameObject.Find("Money_System").GetComponent<MoneySystem> ();
    //public ShopScrollList otherShop;

    // Use this for initialization
    void Start()
    {
        Invent            = GameObject.Find("Inventory_System").GetComponent <InventorySystem> ();
        CurrentBalance    = GameObject.Find("Money_System").GetComponent <MoneySystem> ();
        MoneyBalance.text = CurrentBalance.Money.ToString();
        RefreshDisplay();
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (IsBroken)
        {
            if (repairing)
            {
                float curTime = (Time.time - startTime);
                InteractionController.SetUseDisplay(repairTime, curTime);

                if (curTime >= repairTime)
                {
                    IsBroken  = false;
                    repairing = false;
                    InteractionController.FinishRepair();
                }
            }
            else if ((Time.time - brokenTime) >= autoRepairTime)
            {
                RepairManager.Instance.ShowRepairNotification("Auto repaired " + gameObject.name + " for " + MoneySystem.FormatMoney(autoRepairCost));

                IsBroken = false;
                InteractionController.FinishRepair();
                MoneySystem.TakeMoney(autoRepairCost);
            }
        }
    }
예제 #4
0
 // Start is called before the first frame update
 void Start()
 {
     money  = FindObjectOfType <MoneySystem>();
     health = FindObjectOfType <HealthController>();
     healthPotionLabel.text = healthPotionPrice.ToString();
     extraLifeLabel.text    = extraLifePrice.ToString();
 }
예제 #5
0
 void Start()
 {
     money = FindObjectOfType <MoneySystem>();
     silverButton.onClick.AddListener(SilverButton);
     goldButton.onClick.AddListener(GoldButton);
     diamondButton.onClick.AddListener(DiamondButton);
 }
예제 #6
0
 void Start()
 {
     ThisTr     = this.gameObject.GetComponent <Transform>();
     SearchPos  = ThisTr;
     resourcel  = GameObject.Find("NumUIPrefab").gameObject.GetComponent <ResourceUI>();
     Money      = GameObject.Find("Husband").gameObject.GetComponent <MoneySystem>();
     WifeInfo   = GameObject.Find("Wife").gameObject.GetComponent <Wife>();
     Hit_motion = GameObject.Find("UI/Hit_Montion").gameObject.GetComponent <HitMontion>();
 }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag ("Player");
        mSystem = player.GetComponent<MoneySystem> ();
        collider = GetComponent<Collider> ();
         p = player.GetComponent<PlayerInventory> ();

        currentHP = startingHP;
    }
예제 #8
0
    // Start is called before the first frame update
    void Start()
    {
        gameObject.name = "MoneySystem";
        mInstance       = this;

        //load saved money
        //AddMoney(PlayerPrefs.GetInt("MoneySave", 0));

        //start the save interval
        //StartCoroutine(SaveMoney());
    }
예제 #9
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Weapon"))
     {
         PickUpWeapon(collision.gameObject.name);
     }
     if (collision.gameObject.CompareTag("Coin"))
     {
         MoneySystem.AddMoney(1);
     }
 }
예제 #10
0
    //List<GameObject> agents;

    void Start()
    {
        gameManager = GameObject.Find("GameManager");
        gameScript  = gameManager.GetComponent <GameManager>();

        bank        = GameObject.Find("Bank");
        moneySystem = bank.GetComponent <MoneySystem>();

        agentCount = gameScript.agentNum;
        //agents = GetAllChilds(agentContainer);
    }
예제 #11
0
    // Start is called before the first frame update
    void Start()
    {
        ProductName.text = item.name;
        ProductDesc.text = item.desc;
        BuyButton.GetComponentInChildren <TextMeshProUGUI>().text = MoneySystem.FormatMoney(item.price);

        if (item.image)
        {
            ProductImage.sprite = item.image;
        }
    }
예제 #12
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1;

        item   = GameObject.FindGameObjectsWithTag("Item");
        weapon = GameObject.FindGameObjectsWithTag("Weapon");
        magic  = GameObject.FindGameObjectsWithTag("Magic");
        player = GameObject.FindGameObjectWithTag("Player");

        money = new MoneySystem();
        info  = new StoredInformation();
    }
예제 #13
0
 void Start()
 {
     try
     {
         dm = gameObject.GetComponent <DispensaryManager>();
         mS = gameObject.GetComponent <MoneySystem>();
         //uiM_v2 = GameObject.Find("MenuManager").GetComponent<UIManager_v2>();
     }
     catch (NullReferenceException)
     {
     }
 }
예제 #14
0
    // Use this for initialization
    void Awake()
    {
        //Make sure the Gameobject is named MoneySystem.
        gameObject.name = "MoneySystem";
        _instance       = this;

        //Load the saved money from last game
        //AddMoney(PlayerPrefs.GetInt("MoneySave", 0));

        //Update Money
        actualIncome = baseIncome;
        SaveMoney();
    }
예제 #15
0
    void Start()
    {
        //Make sure the Gameobject is named MoneySystem.
        gameObject.name = "MoneySystem";

        _instance = this;

        //load the saved money
        AddMoney(PlayerPrefs.GetInt("MoneySave", 0));

        //start the save interval.
        StartCoroutine("SaveMoney");
    }
예제 #16
0
    // Update is called once per frame
    void Update()
    {
        moneyText.text = MoneySystem.FormatMoney(MoneySystem.GetMoney());

        if (Input.GetButtonDown("Pause"))
        {
            TogglePause();
        }

        DateTime time = DateTime.Now;

        smallHand.rotation = Quaternion.Euler(0, 0, 360f - (0.5f * (60 * time.Hour + time.Minute)));
        bigHand.rotation   = Quaternion.Euler(0, 0, 360f - (6f * time.Minute));
    }
예제 #17
0
    // Use this for initialization

    void Awake()
    {
        m_ListSpawn = GameObject.FindGameObjectsWithTag(TAG_SPAWN_ENTREGA_END);
        if (m_ListSpawn == null)
        {
            Debug.Log("m_ListSpawn == NULL - tag não encotrada");
        }

        //if (m_ListSpawn.Length > 0) { m_Rand = Random.Range(0, m_ListSpawn.Length - 1); } // gera um indice aleatorio
        //m_Rand = GeraIndiceAleatorio();
        //m_goEntregaEnd = Instantiate(m_pfEntregaEnd, m_ListSpawn[m_Rand].transform.position, Quaternion.identity);
        //if (m_goEntregaEnd == null) { Debug.Log("EntregaEnd == NULL - não encotrado"); }

        m_goArrow = Instantiate(m_pfArrow, m_SpawnArrow.position, Quaternion.identity);
        if (m_goArrow == null)
        {
            Debug.Log("m_goArrow == NULL - não encotrado");
        }

        scriptMS = GameObject.FindWithTag(TAG_MONEY_SYSTEM).GetComponent <MoneySystem>();
        if (scriptMS == null)
        {
            Debug.Log("MONEY SYSTEM == NULL - tag não encotrada");
        }

        m_goEntregaBegin = GameObject.FindWithTag(TAG_ENTREGA_START);
        if (m_goEntregaBegin == null)
        {
            Debug.Log("EntregaStart == NULL - tag não encotrada");
        }

        //m_goEntregaEnd = GameObject.FindWithTag(TAG_ENTREGA_END);

        if (m_goEntregaBegin != null)
        {
            m_goEntregaBegin.SetActive(true);
        }
        if (m_goEntregaEnd != null)
        {
            m_goEntregaEnd.SetActive(false);
        }
        if (m_goArrow != null)
        {
            m_goArrow.SetActive(false);
        }
    }
예제 #18
0
    // Use this for initialization
    public void Start()
    {
        info = new PlayerInformation();
        info.Awake();
        chars           = new CharacterGen();
        enemyTypeNumber = 0;
        playerNumber    = 1;
        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++)
        {
            info.GetPrimaryAttribute(i).BaseValue = chars.STARTING_VALUE;
        }
        characterName           = String.Empty;
        itemAmount              = 0;
        _primaryAttribute       = new string[info._primaryAttribute.Length];
        _primaryAttributeValues = new int[info._primaryAttribute.Length];
        _vital            = new string[info._vital.Length];
        _vitalValue       = new int[info._vital.Length];
        _mana             = new string[info._mana.Length];
        _manaValue        = new int[info._mana.Length];
        _attack           = new string[info._attack.Length];
        _attackValue      = new int[info._attack.Length];
        _defence          = new string[info._defence.Length];
        _defenceValue     = new int[info._defence.Length];
        moneyTotal        = 0;
        money             = new MoneySystem();
        itemsNameArray    = new ArrayList();
        itemsContentArray = new ArrayList();
        experience        = 100;

        nextLevelvalue = experience * 1.2f;
        nextLevel      = (int)(experience * 1.2f);
        level          = 1;
        initiliseConstantVariables();

        playerPos = GameObject.FindGameObjectWithTag("Player");
        if (playerPos != null)
        {
            positionOnScreen = playerPos.transform.position;
        }


        if (PlayerPrefs.GetString("Player Name") != "")
        {
            LoadData();
        }
    }
예제 #19
0
        public override void update()
        {
            if (IntroTimer.GetFinished())
            {
                TimeSystem.update();

                if (IntroCard != null)
                {
                    IntroCard.destroy();
                    IntroCard = null;
                }
            }

            base.update();

            ItemPickupSystem.Update();
            HUDPositionSystem.Update();
            BurningSystem.Update();
            MoneySystem.Update();
        }
예제 #20
0
    private void Start()
    {
        currentScene     = SceneManager.GetActiveScene().name;
        healthController = healthControllerContainer.GetComponent <HealthController>();
        moneySystem      = moneySystemContainer.GetComponent <MoneySystem>();
        questManager     = questContainer.GetComponent <QuestManager>();
        menu             = menuContainer.GetComponent <PauseMenuScript>();
        blacksmith       = blacksmithContainer.GetComponent <BlacksmithController>();

        if (SaveWorker.SaveExists() && PlayerPrefs.GetString("newGame") == "false")
        {
            Load();
        }
        if (currentScene == "FirstScene")
        {
            PlayerPrefs.SetString("newGame", "false");
        }

        Save();
    }
예제 #21
0
    void Update()
    {
        if (Input.GetAxisRaw("Interact") != 0.0f && playerIsInTrigger)
        {
            uiController.DisplayMessage("Want more ammo?\n(1) Yes\n(2) No");
            askedQuestion = true;
        }

        if (Input.GetAxisRaw("Alpha1") != 0.0f && askedQuestion && playerIsInTrigger)
        {
            uiController.DisplayMessage("Here");
            MoneySystem moneySystem = GameObject.FindGameObjectWithTag("Player").GetComponent <MoneySystem>();
            moneySystem.Decrease(GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterActions>().GetAmmo(Mathf.Min(moneySystem.amtOfMoney, amtOfAmmoGiven)));
            askedQuestion = false;
        }
        else if (Input.GetAxisRaw("Alpha2") != 0.0f && askedQuestion && playerIsInTrigger)
        {
            uiController.DisplayMessage("What is wrong with you?");
            askedQuestion = false;
        }
    }
예제 #22
0
 public void CheckPrice(string id, int price)
 {
     Debug.Log("I have been clicked " + id);
     if (MoneySystem.BuyItem(price))
     {
         foreach (ShopItem item in items)
         {
             if (item.id == id)
             {
                 item.ownedNum++;
                 break;
             }
         }
         Debug.Log("Item bought!");
         BuildList();
     }
     else
     {
         Debug.Log("Can't afford");
     }
 }
예제 #23
0
    // Use this for initialization
    void Start()
    {
        MoneyReward     = Random.Range(200, 1000);
        RewardText.text = MoneyReward.ToString();
        Invent          = GameObject.Find("Inventory_System").GetComponent <InventorySystem> ();
        Money           = GameObject.Find("Money_System").GetComponent <MoneySystem> ();
        //NPC Details
        NPC_Name.text       = NPC_NameList [Random.Range(0, NPC_NameList.Count)];
        NPC_Race.text       = NPC_RaceList [Random.Range(0, NPC_RaceList.Count)];
        NPC_Occupation.text = NPC_OccupationList [Random.Range(0, NPC_OccupationList.Count)];
        NPC_Hometown.text   = NPC_HometownList [Random.Range(0, NPC_HometownList.Count)];

        //Potion Details
        Potion              = Requested_Potion [Random.Range(0, Requested_Potion.Count)];
        Potion_Name.text    = Potion.PotionName;
        Potion_Image.sprite = Potion.PotionGraphic;


        //Request
        Request_Text.text = Potion.Requests [Random.Range(0, Potion.Requests.Count)];
    }
    public void EvaluateOrder()
    {
        //Assume
        bool orderComplete = true;

        for (int i = 0; i < order.items.Count; i++)
        {
            if (!order.items[i].has)
            {
                orderComplete = false;
                break;
            }
        }

        if (orderComplete)
        {
            serviceComplete = true;
            happiness       = 1;
            MoneySystem.AddMoney(order.cost);
            orderBubble.Clear();
        }
    }
예제 #25
0
    /// <summary>
    /// Initilises the variables.
    /// </summary>
    public void initiliseConstantVariables()
    {
        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++)
        {
            _primaryAttribute [cnt]      = ((AttributeName)cnt).ToString();
            _primaryAttributeValues[cnt] = info.GetPrimaryAttribute(cnt).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(VitalName)).Length; i++)
        {
            _vital[i]      = ((VitalName)i).ToString();
            _vitalValue[i] = info.GetVitals(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(ManaName)).Length; i++)
        {
            _mana[i]      = ((ManaName)i).ToString();
            _manaValue[i] = info.GetMana(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(AttackName)).Length; i++)
        {
            _attack[i]      = ((AttackName)i).ToString();
            _attackValue[i] = info.GetAttack(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(DefenceName)).Length; i++)
        {
            _defence[i]      = ((DefenceName)i).ToString();
            _defenceValue[i] = info.GetDefence(i).AdjustedBaseValue;
        }
        positionOnScreen.x = PlayerPrefs.GetFloat("Position - x");
        positionOnScreen.y = PlayerPrefs.GetFloat("Position - y");
        positionOnScreen.z = PlayerPrefs.GetFloat("Position - z");

        GameObject        objGame  = GameObject.FindGameObjectWithTag("Constant");
        StoredInformation storedIN = objGame.GetComponent <StoredInformation>();

        moneyTotal = 0;
        money      = new MoneySystem();

        if (Application.loadedLevelName == "NewGame")
        {
            level               = 1;
            experience          = 100;
            storedIN.level      = 1;
            storedIN.experience = 100;

            storedIN.nextLevelvalue = experience * 1.2f;
            storedIN.nextLevel      = (int)(experience * 1.2f);
            nextLevelvalue          = experience * 1.2f;
            nextLevel = (int)(experience * 1.2f);

            moneyTotal          = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else if ((PlayerPrefs.GetInt("Money") != null) || (PlayerPrefs.GetInt("Money") != 0))
        {
            moneyTotal          = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
            level               = PlayerPrefs.GetInt("Level");
            experience          = PlayerPrefs.GetInt("Experience");
            storedIN.experience = experience;

            storedIN.level = level;
            if (level == 0)
            {
                level               = 1;
                storedIN.level      = 1;
                storedIN.experience = 100;
                experience          = 100;
            }
        }
        else if (moneyTotal == 0)
        {
            moneyTotal          = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else
        {
            moneyTotal          = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
        }

        info.StatUpdate();
        _vitalValue   = info.VitalUpdate();
        _attackValue  = info.AttackUpdate();
        _defenceValue = info.DefenceUpdate();
        _manaValue    = info.ManaUpdate();

        if (characterName == String.Empty)
        {
            characterName          = PlayerPrefs.GetString("Player Name");
            storedIN.characterName = PlayerPrefs.GetString("Player Name");
        }

        itemsNameArray    = new ArrayList();
        itemsContentArray = new ArrayList();
    }
    // Use this for initialization
    public void Start()
    {
        info = new PlayerInformation();
        info.Awake();
        chars = new CharacterGen();
        enemyTypeNumber =0;
        playerNumber =1;
        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++) {
            info.GetPrimaryAttribute (i).BaseValue = chars.STARTING_VALUE;
        }
        characterName = String.Empty;
        itemAmount = 0;
        _primaryAttribute = new string[info._primaryAttribute.Length];
        _primaryAttributeValues=new int[info._primaryAttribute.Length];
        _vital = new string[info._vital.Length];
        _vitalValue=new int[info._vital.Length];
        _mana = new string[info._mana.Length];
        _manaValue=new int[info._mana.Length];
        _attack = new string[info._attack.Length];
        _attackValue = new int[info._attack.Length];
        _defence = new string[info._defence.Length];
        _defenceValue = new int[info._defence.Length];
        moneyTotal=0;
        money = new MoneySystem();
        itemsNameArray = new ArrayList();
        itemsContentArray = new ArrayList();
        experience =100;

        nextLevelvalue = experience*1.2f;
        nextLevel = (int)(experience*1.2f);
        level =1;
        initiliseConstantVariables();

        playerPos = GameObject.FindGameObjectWithTag("Player");
        if(playerPos!=null)
            positionOnScreen= playerPos.transform.position;

        if(PlayerPrefs.GetString ("Player Name")!= ""){
            LoadData();
        }
    }
    /// <summary>
    /// Initilises the variables.
    /// </summary>
    public void initiliseConstantVariables()
    {
        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++){
            _primaryAttribute [cnt] = ((AttributeName)cnt).ToString ();
            _primaryAttributeValues[cnt] = info.GetPrimaryAttribute(cnt).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(VitalName)).Length; i++){
            _vital[i] = ((VitalName)i).ToString ();
            _vitalValue[i] = info.GetVitals(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(ManaName)).Length; i++){
            _mana[i] = ((ManaName)i).ToString ();
            _manaValue[i] = info.GetMana(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(AttackName)).Length; i++){
            _attack[i] = ((AttackName)i).ToString ();
            _attackValue[i] = info.GetAttack(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(DefenceName)).Length; i++){
            _defence[i] = ((DefenceName)i).ToString ();
            _defenceValue[i] = info.GetDefence(i).AdjustedBaseValue;
        }
        positionOnScreen.x=PlayerPrefs.GetFloat("Position - x");
        positionOnScreen.y=PlayerPrefs.GetFloat("Position - y");
        positionOnScreen.z=PlayerPrefs.GetFloat("Position - z");

        GameObject objGame = GameObject.FindGameObjectWithTag ("Constant");
        StoredInformation storedIN = objGame.GetComponent<StoredInformation>();
        moneyTotal=0;
        money = new MoneySystem();

        if(Application.loadedLevelName=="NewGame"){
            level =1;
            experience=100;
            storedIN.level =1;
            storedIN.experience=100;

            storedIN.nextLevelvalue = experience*1.2f;
            storedIN.nextLevel = (int)(experience*1.2f);
            nextLevelvalue = experience*1.2f;
            nextLevel = (int)(experience*1.2f);

            moneyTotal = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else if((PlayerPrefs.GetInt("Money")!= null)||(PlayerPrefs.GetInt("Money")!= 0)){
            moneyTotal = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
            level = PlayerPrefs.GetInt("Level");
            experience = PlayerPrefs.GetInt("Experience");
            storedIN.experience = experience;

            storedIN.level = level;
            if(level==0){
                level=1;
                storedIN.level=1;
                storedIN.experience=100;
                experience=100;
            }

        }
        else if(moneyTotal==0){
            moneyTotal = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else{
            moneyTotal = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
        }

        info.StatUpdate();
        _vitalValue=info.VitalUpdate();
        _attackValue=info.AttackUpdate();
        _defenceValue=info.DefenceUpdate();
        _manaValue=info.ManaUpdate();

        if(characterName==String.Empty){
            characterName = PlayerPrefs.GetString ("Player Name");
            storedIN.characterName = PlayerPrefs.GetString ("Player Name");
        }

        itemsNameArray = new ArrayList();
        itemsContentArray = new ArrayList();
    }
예제 #28
0
 //Met à jour le UI Text avec l'argent du joueur
 public void UpdateMoney()
 {
     money.text = "Money : " + MoneySystem.GetMoney() + " $";
 }
예제 #29
0
    void Start()
    {
        //Make sure the Gameobject is named MoneySystem.
        gameObject.name = "MoneySystem";

        _instance = this;

        //load the saved money
        AddMoney(PlayerPrefs.GetInt("MoneySave", 0));

        //start the save interval.
        StartCoroutine("SaveMoney");
    }
예제 #30
0
 //Met à jour le UI Text du menu d'upgrade avec l'argent du joueur
 private void UpdateMoneyUpgrade()
 {
     moneyUpgrade.text = "Budget : " + MoneySystem.GetMoney() + " $";
 }
예제 #31
0
 // Use this for initialization
 void Start()
 {
     inven = player.GetComponent<PlayerInventory>();
     mSystem = player.GetComponent<MoneySystem>();
 }
예제 #32
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale=1;

        item = GameObject.FindGameObjectsWithTag("Item");
        weapon = GameObject.FindGameObjectsWithTag("Weapon");
        magic = GameObject.FindGameObjectsWithTag("Magic");
        player = GameObject.FindGameObjectWithTag("Player");

        money = new MoneySystem();
        info = new StoredInformation();
    }
예제 #33
0
 // Update is called once per frame
 void Update()
 {
     txt.text = "$" + MoneySystem.GetMoney();
 }
 public override void onAddedToEntity()
 {
     MoneySystem.Add(this);
 }
 public override void onRemovedFromEntity()
 {
     MoneySystem.Remove(this);
 }
예제 #36
0
 private void Start()
 {
     rb    = gameObject.GetComponent <Rigidbody>();
     Money = GameObject.FindGameObjectWithTag("MoneySystem").GetComponent <MoneySystem>();
     Destroy(gameObject, 2f);
 }
예제 #37
0
 // Use this for initialization
 void Start()
 {
     inven = player.GetComponent<PlayerInventory> ();
     mSystem = player.GetComponent<MoneySystem> ();
     pM = hud.GetComponent<PauseMenu> ();
 }