示例#1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        timer = FindObjectOfType <Timer2>();
        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            if (ResourceManager.wood >= 10 && ResourceManager.stone >= 1 && BB_BasicControls.ironMBuilt < 1)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);
                ResourceManager.subWood(10);
                ResourceManager.subStone(1);
                BB_BasicControls.ironMBuilt++;
                BB_BasicControls.buildBuilt++;
                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);
                CommonHappinessIndex.RecaclculateHappinessIndex();

                //Debug.Log(ironMBuilt);
            }
        }
    }
示例#2
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        timer = FindObjectOfType <Timer2>();
        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            foreach (var o in NPCSystem.followers)
            {
                if (o.Status == "idle")
                {
                    NPCCountAvl++;
                }
            }

            if (ResourceManager.wood >= 5 && NPCCountAvl >= 1 && tavernBuilt < 1)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);
                ResourceManager.subWood(5);
                tavernBuilt++;

                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);
                CommonHappinessIndex.RecaclculateHappinessIndex();

                Debug.Log(tavernBuilt);
            }
        }
    }
示例#3
0
    //WHAT HAPPENS WHEN SEND FOLLOWER BUTTON IS CLICKED
    void SendFollower()
    {
        if (IDofFollowerdoingQuest == 0 && NodeisActive == true) //CONSIDERED TO BE CHANGEED WITH VALUE IN FOLLOWERSLOT
        {
            Debug.Log("NoFollowerSelected");
            PopUpNoFollowerSelected();
        }

        else if (QuestisActive == false && QuestNumber == GameObject.Find("QuestList").GetComponent <QuestList>().Questnumber)
        {
            //IDofFollowerdoingQuest = GameObject.Find("FollowerSlots").GetComponent<FollowerSlotsManager>().ActiveFollowerSlotID;

            QuestTimeRequired = GameObject.Find("QuestList").GetComponent <QuestList>().Quest_Time; //To get the time required to finish the quest
            QuestTimeStart    = TimerBaar.GetComponent <Timer2>().calen;

            GameObject.Find("FollowerSlots").GetComponent <FollowerSlotsManager>().ChangeFollowerStatebetweenBusyandIdle(IDofFollowerdoingQuest);

            //NIYATI's HAPPINESS
            CommonHappinessIndex.RecaclculateHappinessIndex();

            QuestisActive = true;
            NodeisActive  = false;
            ChangeColourofNode();


            ResetQuestActiveFollower();
            QuestMenu.SetActive(false);
        }
    }
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        //int wShop;
        //wShop = GameObject.Find("WorkshopImg").GetComponent<WorkshopDragHandler>().wShopBuilt;
        wShop = BB_BasicControls.wShopBuilt;
        timer = FindObjectOfType <Timer2>();


        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            foreach (var o in NPCSystem.followers)
            {
                if (o.Status == "idle")
                {
                    NPCCountAvl++;
                }
            }

            if (ResourceManager.wood >= 10 && NPCCountAvl >= 1 && ResourceManager.iron >= 1 && ResourceManager.stone >= 1 && wShop > 1 && BB_BasicControls.BarrackBuilt < 1)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);

                ResourceManager.subWood(10);
                ResourceManager.subIron(1);
                ResourceManager.subStone(1);
                BB_BasicControls.BarrackBuilt++;
                BB_BasicControls.buildBuilt++;

                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);
                CommonHappinessIndex.RecaclculateHappinessIndex();

                //Debug.Log(BarrackBuilt);
            }
        }
    }
示例#5
0
    public void OnEndDrag(PointerEventData eventData)
    {
        transform.localPosition = startPosition;
        timer = FindObjectOfType <Timer2>();
        if (timer.timeOfDay < 150 && !Timer2.harshWeather)
        {
            if (ResourceManager.wood >= 5 && BB_BasicControls.houseBuilt < 4)
            {
                //transform.position = Vector3.zero;
                //Destroy (clone, 0.1f);


                //Debug.Log("Ennnnd" + transform.position.x);
                //Debug.Log("Ennnnnd" + transform.position.y);

                mousepos    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                linehandler = Instantiate(building, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity) as GameObject;
                linehandler.transform.SetAsLastSibling();
                linehandler.transform.position = mousepos;
                linehandler.SetActive(true);

                //Collider[] hitColliders = Physics.OverlapBox(linehandler.transform.position, linehandler.transform.localScale / 2, Quaternion.identity);

                //Check when there is a new collider coming into contact with the box

                ResourceManager.subWood(5);
                BB_BasicControls.houseBuilt++;
                BB_BasicControls.buildBuilt++;
                CommonHappinessIndex.RecaclculateHappinessIndex();



                //npc = new NPCApplicants();
                //  npc.PopulateList();

                //Debug.Log(houseBuilt);
                displayNPCassignList = true;
            }
        }
    }
示例#6
0
    void Update()
    {
        playerSpeed = player.GetComponent <BB_BasicControls>().speed;

        GameObject go = GameObject.Find("Time_Canvas");

        // ONGOING TIME - TIMER : DAY : SEASON :-
        if (timerActive)
        {
            playButtonTxt.text = "Pause";
            time         += Time.deltaTime;
            timeOfDay    += Time.deltaTime;
            timeOfSeason += Time.deltaTime;
        }

        //  DISPLAY DATE - CALCULATING: DAYS

        calen       = time / wholeDaySeconds;
        datees      = Mathf.FloorToInt(calen + startDay);
        displayDate = Mathf.FloorToInt(datees);
        date.GetComponent <Text>().text = "Day " + displayDate.ToString();

        // SKIP X1
        if (skipActive)
        {
            time         = time + skipTime;
            timeOfDay    = timeOfDay + skipTime;
            timeOfSeason = timeOfSeason + skipTime;
            skipX2Active = false;
            playerSpeed  = 50;
            if (!skipX2Active)
            {
                skipX2ButtonTxt.text = "FFX2";
            }
        }

        // SKIP X2
        if (skipX2Active)
        {
            time         = time + skipTime * 2;
            timeOfDay    = timeOfDay + skipTime * 2;
            timeOfSeason = timeOfSeason + skipTime * 2;
            skipActive   = false;
            playerSpeed  = 250;
            if (!skipActive)
            {
                skipButtonTxt.text = "FF";
            }
        }
        // PLAYER SPEED
        if (!skipX2Active && !skipActive)
        {
            playerSpeed = 8;
        }

        // SHREEYA Additions :SHREEYA :- MINI BOSS DAMAGE

        if (displayDate == 100)
        {
            if (timeOfDay >= 20 && timeOfDay <= 21)
            {
                Debug.Log("dstroy");
                Damage();
            }

            // test = test + 1;
            // Debug.Log(test);
        }

        if (displayDate == 100)
        {
            BaseDamage.MiniBDamage();
        }


        // SPLITTING DAYS INTO :: YEARS AND DAYS :-

        if (displayDate > 100)
        {
            year        = Mathf.FloorToInt(displayDate / 100);
            displayDate = displayDate - 100;
            date.GetComponent <Text>().text = "Year " + year + "  Day " + displayDate.ToString();
        }

        // SEASON - NO OF SEASONS PASSED :
        if (timeOfSeason >= SeasonSeconds)
        {
            season       += 1;
            timeOfSeason -= SeasonSeconds;
        }

        // DAYS RESET TO 1 IF YEAR > 0
        if (timeOfDay >= wholeDaySeconds)
        {
            timeOfDay -= wholeDaySeconds;
        }

        // DAY :-
        if (timeOfDay <= wholeDaySeconds / 2)
        {
            if (timeOfDay >= 20 && timeOfDay <= 21)
            {
                BaseHealthObj.GetComponent <BaseHealth>().BaseHealthCalc();
            }

            DayText.SetActive(true);
            NightText.SetActive(false);
            timeBar.fillAmount = timeOfDay / Daymax;
            timevalue.text     = (timeBar.fillAmount * Daymax).ToString("F0");
            itsDay             = true;
        }
        // NIGHT :-
        if (timeOfDay >= wholeDaySeconds / 2)
        { // activate the code below once merged - NIYATI.
            if (timeOfDay >= 160 && timeOfDay <= 161)
            {
                CommonHappinessIndex.TimeToEat();
                CommonHappinessIndex.RecaclculateHappinessIndex();
                GameObject.Find("HappinessIndex Variant").GetComponent <FollowerLeaving>().updateFollowerLeaving();
            }

            NightText.SetActive(true);
            DayText.SetActive(false);
            float half = timeOfDay / 2;
            timeBar.fillAmount = half / Nightmax;
            timevalue.text     = (timeBar.fillAmount * Nightmax).ToString("F0");
            itsDay             = false;
        }
        // SPRING :-
        if (displayDate <= 25)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds; // SEASON METER.

            seasonName.GetComponent <Text>().text = "Spring";
            Spring();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Spring - harsh";
            }
        }
        else
        {
            SpringUI.SetActive(false);
        }

        // SUMMER :-
        if (displayDate > 25)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Summer";
            Summer();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Summer - harsh";
            }
        }
        else
        {
            SummerUI.SetActive(false);
        }

        // AUTUMN :-
        if (displayDate > 50)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Autumn";
            Autumn();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Autumn- harsh";
            }
        }
        else
        {
            AutumnUI.SetActive(false);
        }

        // WINTER:-
        if (displayDate > 75)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Winter";
            Winter();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Winter- harsh";
            }
        }
        else
        {
            WinterUI.SetActive(false);
        }
    }