Exemple #1
0
 private void Start()
 {
     Agent                  = GetComponent <NavMeshAgent>();
     gm                     = FindObjectOfType <GameManager>();
     goldManager            = FindObjectOfType <GoldManager>();
     Agent.stoppingDistance = Stats.RangeAttack;
 }
Exemple #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemple #3
0
    private int _stageGetMoney; // 스테이지 전체에서 유효한 골드 획득

    private void Awake()
    {
        instance       = this;
        _goldText      = GetComponentInChildren <Text>();
        _roundGetMoney = 0;
        _stageGetMoney = 0;
    }
Exemple #4
0
    private void Awake()
    {
        GameObject phaseManager = GameObject.FindGameObjectWithTag("Phase_Manager");

        goldManager     = phaseManager.GetComponent <GoldManager>();
        playerObjective = phaseManager.GetComponent <RunTimePhaseData>().idtPhaseType;
    }
    public void OnClickSell()
    {
        if (selected == null)
        {
            Debug.LogError("판매 오류!");
        }

        List <QuestPerMob> temp = new List <QuestPerMob>();

        QuestPerMob qpm = new QuestPerMob(
            msBtnDic[(int)selected].mob,
            msBtnDic[(int)selected].evidence,
            sellNumber
            );

        temp.Add(qpm);

        Inventory.GetInstance().MinusMobEviItem(temp);

        GoldManager.GetInstance().AdjustGold((msBtnDic[(int)selected].price * sellNumber), GoldManager.E_PayType.SELL_TO_MERCHANT);

        HideTab();
        ShowTab();
        //인벤토리에서 빼주고고.
        //골드 까주고.
    }
    public void RebuildRubble()
    {
        GameObject  TwrDestroyed   = pStatus.turretDestroyed;                                              //trova qual'è la torretta distrutta
        GoldManager goldMG         = GameObject.Find("GameManager").GetComponent <GoldManager>();          //trova il GoldManager
        int         price          = TwrDestroyed.GetComponent <Turret_LookAtRobot>().GetPriceToRebuild(); //costo di ricostruzione
        int         moneyPossessed = goldMG.money;                                                         //controlla quanti soldi ha il giocatore


        if (moneyPossessed >= price)    //se il giocatore ha abbastanza soldi per poter comprare...
        {
            Turret_HealthBar NT_HealthBar = TwrDestroyed.GetComponent <Turret_HealthBar>();
            Destroy(pStatus.turretOnTop);               //distruggi le rovine

            TwrDestroyed.SetActive(true);               //ricrea la torre scelta nello spawnPoint che hai cliccato
            NT_HealthBar.SetHealth();                   //resetta la sua vita
            Rebuild_Panel.SetActive(false);             //chiudi il pannello Build
            pStatus.changePlatformStatus(TwrDestroyed); //imposta lo stato della piattaforma su "occupato"
            repairScript.addTorretta(TwrDestroyed);     //aggiungi la torretta alla lista delle torrette nel livello
            NT_HealthBar.SetPlatform(TempTarget);       //assegna la base di provenienza alla torretta

            //sottrai i soldi
            goldMG.ChangeMoney(-price);//trova il GameManager,prendi il component GoldManager e chiama il comando per cambiare i soldi(ChangeMoney)
        }
        else
        {
            if (!Povero_Panel.activeInHierarchy)    //se il pannello di avviso non è già visibile...
            {
                //Debug.Log("Sei povero");
                Povero_Panel.SetActive(true);       //...fai apparire il pannello di avviso
            }
        }
    }
Exemple #7
0
    // Start is called before the first frame update
    void Start()
    {
        cubehighlight       = Resources.Load("Outline", typeof(Material)) as Material;
        cubenolight         = Resources.Load("Normal", typeof(Material)) as Material;
        cubehighlight.color = Color.white;
        cubenolight.color   = Color.white;
        group = 0;
        //graycast = New GraphicRaycaster();
        mes = GetComponent <EventSystem>();
        //initialize literally everything
        //gold manager
        gold = GameObject.FindObjectOfType <GoldManager>();
        g    = gameObject.GetComponent <GridManager>();
        //box collider for the grid to know when its clicked on
        BoxCollider b = gameObject.GetComponent <BoxCollider>();

        b.center = b.center + new Vector3(g.w / 2, 0, g.h / 2);
        b.size   = new Vector3(g.w + 1, 1, g.h + 1);
        //track when grid is awake or asleep
        state = 0;
        awake = false;
        //turret prefab and holder (holder not yet implemented)
        bh_transform = FindObjectOfType <Building_Holder>().gameObject.transform;
        cam          = GameObject.FindObjectOfType <CameraController>().gameObject;
        //this isnt working, so need to set this in the editor manually
        //blocker = GameObject.FindObjectOfType<Blocker>().gameObject;
        //blocker.SetActive(false);
        tss = turretshop.GetComponent <TurretShop>();
        ng  = Object.FindObjectOfType <nogold>();
    }
Exemple #8
0
    void ContinuePurchase()
    {
        Vector2Int gridPos = SnapUnderCursor();

        //Check if the player just removed their finger over a free tile and if they have enough money
        //Changes the tower material, displays an error message and/or places the tower, depending on the case
        if (GridManager.TileIsFree(gridPos))
        {
            if (Input.GetMouseButtonUp(0) && IsOnGrid())
            {
                if (GoldManager.CanAfford(tower.type.price))
                {
                    EndPurchase();
                }
                else
                {
                    UIManager.DisplayText(GameManager.Instance.insufficientGoldText);
                }
            }
            else
            {
                SetMaterial((GoldManager.CanAfford(tower.type.price)) ? transparent : transparentRed);
            }
        }
        else
        {
            SetMaterial(transparentRed);
            if (Input.GetMouseButtonUp(0))
            {
                GridManager.TryBuildOnTile(gridPos);
            }
        }
    }
 public void EndOfCallItADay()
 {
     //게임매니저에서 퀘스트룸 씬 로딩하게.
     GoldManager.GetInstance().DayOff();
     GameManager.GetInstance().ContinueDay();
     //게임 매니저 퀘스트룸 호툴 부분
 }
    public void QuestMakingDone(List <QuestPerMob> madeQPMList)//작성한 퀘스트.
    {
        if (madeQPMList == null || madeQPMList.Count == 0)
        {
            Debug.LogError("퀘스트 메이킹 작업물이 존재하지 않음.");
        }


        ClientIdea client = CharactorFrame.GetInstance().clientIdea;
        string     newKey = Quest.MakeQuestKey(client.CharaName);

        Quest writtenQuest = new Quest();   //작성한 퀘스트 생성.

        writtenQuest.SettingQuestMetaDataByToday(newKey, client.CharaName, client.DaysExpire, madeQPMList);
        QuestManager.GetInstance().AddQuest(newKey, writtenQuest); //퀘스트매니져에 작성한 퀘스트를 넣어둬
        client.SetHasCommission(newKey);                           //여기서 의뢰인의 오리진 퀘스트 의뢰일과 만기가 설정됨.

        MainCamAnim.GetInstance().CamToPosNormal(
            () => {
            CharactorFrame.GetInstance().UpdateFSM();                                                             //메인 카메라가 원상태로 복귀한 후에 fsm 업뎃해주기 위해.

            int deposit = PayFormula.CalculateClientRequestDeposit(client.OriginOrderedQuest, client.DaysExpire); //디포짓 얻는 것.
            GoldManager.GetInstance().AdjustGold(deposit, GoldManager.E_PayType.FROM_CLIENT);
        });                                                                                                       //메인카메라 원상태로.
        // CharactorFrame.GetInstance().UpdateFSM(); 메인 카메라가 원상태로 복귀한 후에 fsm 업뎃해주기 위해. 여기서 업뎃하면 안댐
    }
 // Use this for initialization
 void Start()
 {
     AS   = GameObject.Find("PotSound").GetComponent <AudioSource>();
     H    = FindObjectOfType <Health> ();
     GM   = FindObjectOfType <GoldManager> ();
     cant = GameObject.Find("Potions(PotionsManager) - Text").GetComponent <Text> ();
 }
    private void Awake()
    {
        GameObject[] positionsGameObjects = GameObject.FindGameObjectsWithTag("AI_Build_Position");
        buildingPositions = new List <Vector2>();

        for (int i = 0; i < positionsGameObjects.Length; i++)
        {
            buildingPositions.Add(positionsGameObjects[i].transform.position);
        }

        // TO:DO --> This is might be very heavy because a lot of GO do this
        constructionsList = new PriorityList <Transform>();
        GameObject[] towersInPhase = GameObject.FindGameObjectsWithTag("Tower");
        foreach (GameObject tower in towersInPhase)
        {
            int orderInAttack = tower.GetComponent <TowerAttackOrder>().orderInAttack;
            constructionsList.Add(tower.transform, orderInAttack);
        }

        GameObject core           = GameObject.FindGameObjectWithTag("Core");
        int        lastTowerOrder = constructionsList.GetFirst().Priority;

        constructionsList.Add(core.transform, lastTowerOrder);

        GameObject phaseManager = GameObject.FindGameObjectWithTag("Phase_Manager");

        goldManager = phaseManager.GetComponent <GoldManager>();
    }
 // Start is called before the first frame update
 void Start()
 {
     trans      = gameObject.transform;
     num_active = 0;
     num_build  = 0;
     last       = gameObject;
     on         = false;
     g          = Object.FindObjectOfType <GoldManager>();
 }
Exemple #14
0
	void Death () {
		GoldManager.AddGold (type.reward);
		monsterList.Remove (transform);

		if (WaveManager.wavesAreOver && monsterList.Count == 0)
			FlowManager.Victory();
		
		Destroy (gameObject);
	}
Exemple #15
0
    protected override void Awake()
    {
        base.Awake();
        goldMgr = FindObjectOfType<GoldManager>();

        coolTime = 60;
        message = "골드 획득량이 일정시간동안 증가합니다";
        itemGoldIncrement = 0;
    }
Exemple #16
0
 ///<summary>Calls _Start method in all managers</summary>
 void StartManagers()
 {
     GoldManager._Start();
     GridManager._Start();
     LivesManager._Start();
     TimeManager._Start();
     TowerManager._Start();
     WaveManager._Start();
 }
    //public GameObject SwordRayo;

    // Use this for initialization
    void Start()
    {
        gold = FindObjectOfType <GoldManager> ();
        hover.SetActive(false);
        waterIsOn   = false;
        thunderIsON = false;
        //	anim = GameObject.Find ("sword").GetComponent<Animator> ();
        weapon.GetComponent <SpriteRenderer> ().sprite = null;
    }
    public void OnClickBuy()
    {
        if (selected == null)
        {
            Debug.LogError("페이퍼 구입 선택 오류0");
        }

        if (selected <= ((int)E_Monster.MAX) - 1)   //몬스터 허가증인 경우
        {
            E_Monster mob = (E_Monster)selected;
            Debug.Log(mob);

            if (PhaseManager.GetInstance().IsOpen(mob))
            {
                Debug.Log("이미 열린것?");
                HideTab();
                ShowTab();
                return;
            }
            else
            {
                Debug.Log("몬스터 구입");
                PhaseManager.GetInstance().OpenMonsterCertificate(mob);
                GoldManager.GetInstance().AdjustGold(-1 * mpDic[(int)selected].price, GoldManager.E_PayType.BUY_BY_MERCHANT);
                HideTab();
                ShowTab();
                return;
            }
        }
        else
        {
            int eviNum = ((int)selected) - (((int)E_Monster.MAX) - 1);

            E_Evidence evi = (E_Evidence)eviNum;
            Debug.Log(evi);
            if (PhaseManager.GetInstance().IsOpen(evi))
            {
                Debug.Log("이미 열린것?");
                HideTab();
                ShowTab();
                return;
            }
            else
            {
                Debug.Log("증거품 구입");
                PhaseManager.GetInstance().OpenEvidenceCertificate(evi);
                GoldManager.GetInstance().AdjustGold(-1 * mpDic[(int)selected].price, GoldManager.E_PayType.BUY_BY_MERCHANT);
                HideTab();
                ShowTab();
                return;
            }
        }

        //인벤토리에 넣어주고.
        //골드 까주고.
    }
    void Init()
    {
        selected = null;
        miDic.Clear();

        buyBtn.interactable = false;
        nowGold             = GoldManager.GetInstance().Gold;
        nowGoldTxt.text     = nowGold.ToString();

        int miCount = (int)E_Interior.MAX;

        nowLang = LanguageManager.GetInstance().Language;
        //nowLang = E_Language.ENGLISH;

        for (int i = 0; i < miCount; i++)
        {
            string name    = "";
            string comment = "";
            int    price   = merchantInteriorSheet.dataArray[i].Price;
            switch (nowLang)
            {
            case E_Language.KOREAN:
                name    = merchantInteriorSheet.dataArray[i].Namekor;
                comment = merchantInteriorSheet.dataArray[i].Micmtkor;
                break;

            case E_Language.ENGLISH:
                name    = merchantInteriorSheet.dataArray[i].Nameeng;
                comment = merchantInteriorSheet.dataArray[i].Micmteng;
                break;
            }

            int num = i;

            GameObject btn = Instantiate(buyInteriorBtn, buyInteriorContent.transform);

            btn.GetComponent <Button>().onClick.AddListener(
                () =>
            {
                AudioThing.GetInstance().PlaySFX(AudioThing.E_SFX.CLICK);
                SelectInterior(num);
            }

                );
            miDic.Add(num, new miBtn((E_Interior)i, btn, name, price, comment));

            SetTxtsInteriorBtn(btn, price, name, (E_Interior)i);

            if (PhaseManager.GetInstance().IsOpen((E_Interior)i))
            {
                btn.GetComponent <Button>().interactable = false;
            }
        }
        ShowDefaultComment();
        GoldAdjustShow(0);
    }
Exemple #20
0
    public void ChangeLevel(string levelName)
    {
        SaveManager.Instance.Save();
        SceneManager.LoadScene(levelName);

        if (SceneManager.GetSceneByName(levelName).buildIndex > levelOneBuildIndex)
        {
            GoldManager.Reset();
        }
    }
Exemple #21
0
    public void ChangeLevel(int levelBuildIndex)
    {
        SaveManager.Instance.Save();
        SceneManager.LoadScene(levelBuildIndex);

        if (levelBuildIndex > levelOneBuildIndex)
        {
            GoldManager.Reset();
        }
    }
 // Use this for initialization
 void Start()
 {
     //	statsSTR = new int[4] {0, 0, 0, 0, 0};
     strSetStats   = "";
     ConfirmSaveHT = false;
     ConfirmSavePS = false;
     PS            = FindObjectOfType <PlayerStats>();
     GM            = FindObjectOfType <GoldManager>();
     PlayerData _PlayerData = new PlayerData();
 }
Exemple #23
0
    public static void IncreaseFoodAmount()
    {
        int amount = 200;

        if (GoldManager.GoldAmount >= amount)
        {
            FoodManager.Instance.MaxFoodAmount++;
            GoldManager.DecreaseGold(amount);
        }
    }
Exemple #24
0
    public static void UpgradeFood()
    {
        int amount = 300;

        if (GoldManager.GoldAmount >= amount)
        {
            FoodManager.Instance.CurrentFoodIndex++;
            GoldManager.DecreaseGold(amount);
        }
    }
Exemple #25
0
 public void SpawnFood()
 {
     if (FoodsOnScreen < maxFoodAmount)
     {
         Vector3 position = cam.ScreenToWorldPoint(Input.mousePosition);
         position.z = 0;
         objectPooler.SpawnFromPool(currentFood.name, position);
         GoldManager.DecreaseGold(5);
     }
 }
Exemple #26
0
 // Use this for initialization
 void Start()
 {
     slider     = GetComponent <Slider>();
     background = GameObject.FindObjectOfType <CanvasBackground>();
     seasonText = GameObject.FindObjectOfType <SeasonText>();
     market     = GameObject.FindObjectOfType <Market>();
     gold       = GameObject.FindObjectOfType <GoldManager>();
     hc         = GameObject.FindObjectOfType <HarvestController>();
     deer       = hc.GetComponent <DeerMovement>();
     symbols    = GameObject.FindObjectOfType <SeasonSymbol>();
 }
Exemple #27
0
 void EndPurchase()
 {
     SetMaterial(opaque);
     GridManager.SetAdjacentTiles(SnapUnderCursor(), GridManager.Tile.TOWER);
     GoldManager.AddGold(-tower.type.price);
     purchaseInProgress             = false;
     tower.purchaseInProgress       = false;
     TowerManager.towerBuildPreview = null;
     TowerManager.SetCancelButton(false, tower.typeNumber);
     tower.Reload();
 }
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
Exemple #30
0
    private void Start()
    {
        Script_GoldManager  = GetComponent <GoldManager>();
        Script_SaveProgress = GetComponent <SaveProgress>();

        // If we haven't set up the Unity Purchasing reference
        if (m_StoreController == null)
        {
            // Begin to configure our connection to Purchasing
            InitializePurchasing();
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     menu_holder = Object.FindObjectOfType <ud_holder>().gameObject;
     awake       = false;
     //should not be live before we drop it into place
     alive          = false;
     bh             = GameObject.FindObjectOfType <Building_Holder>();
     selfnum        = bh.num_build;
     highlighted    = gameObject.GetComponent <MeshRenderer>().material;
     objectRenderer = gameObject.GetComponent <Renderer>();
     g = Object.FindObjectOfType <GoldManager>();
 }
Exemple #32
0
    private void Awake()
    {
        gameMgr = FindObjectOfType<GameManager>();
        goldMgr = FindObjectOfType<GoldManager>();
        orderMgr = FindObjectOfType<SpriteOrderLayerManager>();
        satanCastle = GameObject.Find("SatanCastle");

        for (int i = 1; i <= 3; ++i)
        {
            ourForceLinePos.Add(satanCastle.transform.FindChild(string.Format("Spawn Line{0}", i)).position);
        }
    }
Exemple #33
0
    private void Awake()
    {
        msgBox = FindObjectOfType<MessageBox>();
        goldMgr = FindObjectOfType<GoldManager>();
        roseButtonEffectSource = GetComponent<AudioSource>();
        lever = transform.FindChild("Lever");
        unitButtonTrs = transform.FindChild("UnitsButton");
        upgButtonTrs = transform.FindChild("UpgradeButton");
        goldUpgBtn = upgButtonTrs.FindChild("GoldUpgButton").GetComponent<Button>();

        lever.GetComponent<Button>().onClick.AddListener(ClickedRoseButton);

        // Delete this
        if (PlayerData.instance.selectedUnitList.Count == 0)
        {
            PlayerData.instance.selectedUnitList.Add("Skeleton");
            // PlayerData.instance.selectedUnitList.Add("Goblin");
            //PlayerData.instance.selectedUnitList.Add("Orc");
            PlayerData.instance.selectedUnitList.Add("Dullahan");
            PlayerData.instance.selectedUnitList.Add("Grim");
            PlayerData.instance.selectedUnitList.Add("Werewolf");
            PlayerData.instance.selectedUnitList.Add("Witch");
            //sPlayerData.instance.selectedUnitList.Add("Marionette");
            PlayerData.instance.selectedUnitList.Add("Aragog");
        }

        #region Load

        // 선택된 유닛들 스프라이트 로드
        for (int i = 0; i < PlayerData.instance.selectedUnitList.Count; ++i)
            unitPortaitList.Add(SpriteManager.instance.GetSprite(PackingType.UI,
                PlayerData.instance.selectedUnitList[i]));

        // 유닛버튼들 로드
        for (int i = 0; i < 6; ++i)
            unitButtonList.Add(transform.FindChild("UnitsButton").GetChild(i).GetComponent<Image>());

        // 유닛 prefab 추가
        for (int i = 0; i < unitPortaitList.Count; ++i)
        {
            unitPrefabs.Add(Resources.Load<Movable>("Prefabs/OurForce/" +
                PlayerData.instance.selectedUnitList[i]));
        }

        // 유닛버튼에 스프라이트 대입
        for (int i = 0; i < unitButtonList.Count; ++i)
        {
            if (i > unitPortaitList.Count - 1)
                unitButtonList[i].GetComponent<Button>().interactable = false;
            else
            {
                unitButtonList[i].sprite = unitPortaitList[i];
                unitButtonList[i].GetComponentInChildren<Text>().text = unitPrefabs[i].GetUnitCost().ToString();
            }
        }

        // Button Onclick 추가
        for (int i = 0; i < unitButtonList.Count; ++i)
        {
            int param = i;
            unitButtonList[i].GetComponent<Button>().onClick.AddListener(() => ClikcedUnitButton(param));
        }

        // upgButton Addlistener
        goldUpgBtn.onClick.AddListener(ClickedGoldUpgButton);

        lines = GameObject.FindGameObjectsWithTag("Line");

        #endregion Load
    }