Example #1
0
    protected override void OnCalculate()
    {
        if (DayClass.Hour == 1)
        {
            //Jauni darbi
            AvailableWorks = 5;
        }

        if (GameManager.PlayerStatus != PlayerStatus.FREELANCER || Work == null)
        {
            return;
        }

        if (DayClass.Time >= Work.DueDate)
        {
            //TODO: Neizpildīja darbu laikā jāsamazina peļņa
            Work.Money -= Mathf.CeilToInt(Work.Money * 0.05f);
            if (Work.Money < 0)
            {
                Work.Money = 0;
            }
        }

        Work.DueHours -= Parameters.get(ParamsKind.IQ).Value / Work.IQ;

        if (Work.DueHours <= 0)
        {
            //Darbs izpildīts
            GameManager.AddMoney(Work.Money);
            Work = null;
            GameManager.PlayerStatus = PlayerStatus.NONE;
            GameManager.GamePaused   = true;
            GUImain.CloseAllDialogs();
        }
    }
Example #2
0
    public void OtherWork()
    {
        if (AvailableWorks < 1)
        {
            NoWorks();
            return;
        }

        AvailableWorks--;
        Work = FreelancerWork.Create();
        RedrawData();
    }
Example #3
0
    public override void OpenWorkDialog()
    {
        if (Work == null && AvailableWorks > 0)
        {
            Work = FreelancerWork.Create();
        }

        if (Work == null)
        {
            NoWorks();
            return;
        }
        RedrawData();

        GUImain.ShowDialog(DialogKind.FREELANCER);
    }
Example #4
0
    public static FreelancerWork Create()
    {
        int iq = Random.Range(-10, 10) + (int)Parameters.get(ParamsKind.IQ).Value;
        int hours = Random.Range(100, 300);

        int money = Random.Range(10, 20) * (iq / 18) * hours ;
        money = (money/100)*100;

        FreelancerWork work = new FreelancerWork()
        {
            Name = WorkNames.Random(),
            Hours = hours,
            Money = money,
            IQ = iq
        };

        return work;
    }
Example #5
0
    public static FreelancerWork Create()
    {
        int iq    = Random.Range(-10, 10) + (int)Parameters.get(ParamsKind.IQ).Value;
        int hours = Random.Range(100, 300);

        int money = Random.Range(10, 20) * (iq / 18) * hours;

        money = (money / 100) * 100;

        FreelancerWork work = new FreelancerWork()
        {
            Name  = WorkNames.Random(),
            Hours = hours,
            Money = money,
            IQ    = iq
        };

        return(work);
    }
Example #6
0
    protected override void OnCalculate()
    {
        if (DayClass.Hour == 1)
        {
            //Jauni darbi
            AvailableWorks = 5;
        }

        if (GameManager.PlayerStatus != PlayerStatus.FREELANCER || Work == null)
        {
            return;
        }

        if (DayClass.Time >= Work.DueDate)
        {
            //TODO: Neizpildīja darbu laikā jāsamazina peļņa
            Work.Money -= Mathf.CeilToInt(Work.Money*0.05f);
            if (Work.Money < 0) Work.Money = 0;
        }

        Work.DueHours -= Parameters.get(ParamsKind.IQ).Value/Work.IQ;

        if (Work.DueHours <= 0)
        {
            //Darbs izpildīts
            GameManager.AddMoney(Work.Money);
            Work = null;
            GameManager.PlayerStatus = PlayerStatus.NONE;
            GameManager.GamePaused = true;
            GUImain.CloseAllDialogs();
        }
    }
Example #7
0
    public void OtherWork()
    {
        if (AvailableWorks < 1)
        {
            NoWorks();
            return;
        }

        AvailableWorks --;
        Work = FreelancerWork.Create();
        RedrawData();
    }
Example #8
0
    public override void OpenWorkDialog()
    {
        if (Work == null && AvailableWorks > 0)
        {
            Work = FreelancerWork.Create();
        }

        if (Work == null)
        {
            NoWorks();
            return;
        }
        RedrawData();

        GUImain.ShowDialog(DialogKind.FREELANCER);
    }