예제 #1
0
 void Start()
 {
     player = SaveSEAttributes.LoadPlayer();
     nameText.GetComponent <Text>().text     = player.PlayerName;
     ageText.GetComponent <Text>().text      = Math.Round(player.PlayerAge) + " years old";
     currencyText.GetComponent <Text>().text = "$ " + player.PlayerCurrency;
 }
예제 #2
0
 public static void IncreaseHunger(SEAttributes player) // SE gets more hungry over time
 {
     if (player.Hunger > 0)
     {
         player.Hunger -= 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #3
0
 public static void IncreaseTired(SEAttributes player) // SE gets more tired over time
 {
     if (player.Tired > 0)
     {
         player.Tired -= 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #4
0
 public static void DecreaseMood(SEAttributes player) // SE gets more sad when working
 {
     if (player.Mood > 0)
     {
         player.Mood -= 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #5
0
 public static void IncreaseMood(SEAttributes player) // SE gets happier when using entertainment
 {
     if (player.Mood < 100)
     {
         player.Mood += 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #6
0
 public static void DecreaseHunger(SEAttributes player) // When SE eats
 {
     if (player.Hunger < 100)
     {
         player.Hunger += 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #7
0
 public static void IncreaseFitness(SEAttributes player) // When SE eats
 {
     if (player.Fitness < 100)
     {
         player.Fitness += 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #8
0
 public static void DecreaseFitness(SEAttributes player) // When SE eats
 {
     if (player.Fitness > 0)
     {
         player.Fitness -= 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #9
0
 public static void DecreaseTired(SEAttributes player) // SE gets less tired
 {
     if (player.Tired < 100)
     {
         player.Tired += 1;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #10
0
    // Update is called once per frame
    void Update()
    {
        updateView();
        hourCount -= Time.deltaTime;
        if (Mathf.Round(hourCount) == 0)
        {
            hourCount = 3600;
            projects.hourPass();
            List <Project> projectList = projects.GetProjects();
            foreach (Project item in projectList)
            {
                if (item.Deadline == 0)
                {
                    int id = item.ID;
                    projects.RemoveProjects(id);
                    Project newProject = generateNewProject(id);
                    projects.AddProject(newProject);
                }
            }
        }

        if (workingOn != 0)
        {
            minuteCount[workingOn - 1] -= Time.deltaTime;
            if (ChangeComputer.upgrade)
            {
                minuteCount[workingOn - 1] -= Time.deltaTime;
                UnityEngine.Debug.Log("computer change");
            }
            //print(minuteCount[workingOn - 1]);
            if (Mathf.Round(minuteCount[workingOn - 1]) == 0)
            {
                minuteCount[workingOn - 1] = 1;
                int minuteLeft = projects.minutePass(workingOn);
                //print(minuteLeft);
                if (minuteLeft == 0)
                {
                    Project compProject = projects.GetProject(workingOn);
                    compProject.Completion = true;
                    int awardCurrency = compProject.Currency;
                    int awardExp      = compProject.Exp;

                    SEAttributes player = SaveSEAttributes.LoadPlayer();
                    SEAttributesController.AdjustCurrency(player, awardCurrency);

                    projects.RemoveProjects(workingOn);
                    Project newProject = generateNewProject(workingOn);
                    projects.AddProject(newProject);
                    int temp = workingOn;
                    stopProject();
                    setSceneActive(temp);
                    setPreviousSceneInactive(temp);
                }
            }
        }
    }
예제 #11
0
    // private Sprite chair, chair2, chair3, chair4, chair5;

    // Use this for initialization
    void Start()
    {
        player      = SaveSEAttributes.LoadPlayer();
        moneyAmount = player.PlayerCurrency;
        //moneyAmount = PlayerPrefs.GetInt ("MoneyAmount");

        GameObject initialState = GameObject.Find("Canvas/Chair");

        rend        = initialState.GetComponent <Image>();
        rend.sprite = ChangeChair.chairs[ChangeChair.upgrade + 1];
    }
예제 #12
0
 public static void Rest(SEAttributes player) // SE sleeps and is not tired
 {
     if (player.Tired <= 90)
     {
         player.Tired += 10;
     }
     else if (player.Tired > 90)
     {
         player.Tired = 100;
     }
     SaveSEAttributes.SavePlayer(player);
 }
예제 #13
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         playerInRange = false;
         buttonBox.SetActive(false);
         dialogBox.SetActive(false);
         SEAttributes player = SaveSEAttributes.LoadPlayer();
         player.currState = "";
         SaveSEAttributes.SavePlayer(player);
     }
 }
예제 #14
0
    public void SelectSleep()
    {
        SEAttributes player = SaveSEAttributes.LoadPlayer();

        player.currState = "sleeping";
        SaveSEAttributes.SavePlayer(player);
        if (dialogBox.activeInHierarchy)
        {
            dialogBox.SetActive(false);
        }
        else
        {
            dialogBox.SetActive(true);
        }
        dialog.text = "You are now sleeping..";
    }
예제 #15
0
    public void SelectTv()
    {
        SEAttributes player = SaveSEAttributes.LoadPlayer();

        player.currState = "entertainment";
        SaveSEAttributes.SavePlayer(player);
        if (dialogBox.activeInHierarchy)
        {
            dialogBox.SetActive(false);
        }
        else
        {
            dialogBox.SetActive(true);
        }
        dialog.text = "You are now playing Wii..";
    }
예제 #16
0
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent <Animator>();
        rend     = GetComponent <SpriteRenderer>();
        boy      = Resources.Load <Sprite>("boy");
        girl     = Resources.Load <Sprite>("girl");

        SEAttributes player = SaveSEAttributes.LoadPlayer();

        if (player.PlayerGender == "male")
        {
            rend.sprite = boy;
            animator.SetBool("isMale", true);
        }
        else if (player.PlayerGender == "female")
        {
            rend.sprite = girl;
            animator.SetBool("isMale", false);
        }
    }
예제 #17
0
파일: Death.cs 프로젝트: zhous20/HackerSim
    // Start is called before the first frame update

    void Start()
    {
        player = SaveSEAttributes.LoadPlayer();
        TombText.GetComponent <Text>().text = player.PlayerName + " you died at " + Math.Round(player.PlayerAge) + " years old" + "with $ " + player.PlayerCurrency;
    }
예제 #18
0
    void Start()
    {
        SEAttributes player = SaveSEAttributes.LoadPlayer();

        username = player.PlayerName;
    }
예제 #19
0
 public static void AdjustCurrency(SEAttributes player, double deltaCurrency) // When money is earned (+) or spent (-)
 {
     player.PlayerCurrency += deltaCurrency;
     SaveSEAttributes.SavePlayer(player);
 }
예제 #20
0
    public static void TimeEvent(int gameMinutes, SEAttributes player)
    {
        if (gameMinutes % 7 == 0 && gameMinutes != prevtime) // In ~ 12 hours (1 day), their hunger, tiredness and fitness will be at 0
        {
            for (int i = 0; i >= 0; i -= 15)
            {
                SEAttributesController.IncreaseTired(player);
                SEAttributesController.DecreaseFitness(player);
            }

            SEAttributesController.IncreaseHunger(player);
            SEAttributesController.DecreaseMood(player);

            if (alt)
            {
                if (AddItem.isTree)
                {
                    SEAttributesController.IncreaseMood(player);
                    SEAttributesController.DecreaseHunger(player);
                }
                if (AddItem.isPlant)
                {
                    SEAttributesController.IncreaseMood(player);
                }
            }
            alt = !alt;
        }
        if (player.currState != "" && gameMinutes % 4 == 0 && gameMinutes != prevtime)
        {
            if (player.currState == "entertainment")
            {
                SEAttributesController.IncreaseMood(player);
                if (gameMinutes % 2 == 0 && ChangeTv.upgrade)
                {
                    SEAttributesController.IncreaseMood(player);
                }
            }

            else if (player.currState == "working")
            {
                SEAttributesController.DecreaseMood(player);
                if (gameMinutes % 2 == 0)
                {
                    SEAttributesController.IncreaseTired(player);
                    if (gameMinutes % (6 - ChangeChair.upgrade) == 0)
                    {
                        SEAttributesController.DecreaseTired(player);
                    }
                }
            }

            else if (player.currState == "exercising")
            {
                SEAttributesController.IncreaseFitness(player);
                UnityEngine.Debug.Log("happening");
                if (AddItem.isTread && gameMinutes % 2 == 0)
                {
                    SEAttributesController.IncreaseFitness(player);
                }
            }

            else if (player.currState == "sleeping")
            {
                SEAttributesController.Rest(player);
                SEAttributesController.IncreaseMood(player);
            }
        }
        //UnityEngine.Debug.Log(gameMinutes);
        if (gameMinutes % 25 == 0 && gameMinutes != prevtime)
        {
            //factor = ((double)player.Mood + player.Hunger + player.Tired + player.Fitness)/400;
            player.PlayerAge = player.PlayerAge + 1;
            SaveSEAttributes.SavePlayer(player);
            //UnityEngine.Debug.Log("worked" + player.PlayerAge);
            //UnityEngine.Debug.Log(factor);
        }
        prevtime = gameMinutes;
        CheckDeath(player);
    }
예제 #21
0
    // Update is called once per frame
    void Update()
    {
        SEAttributes player = SaveSEAttributes.LoadPlayer();

        TimeStep.TimeEvent((System.DateTime.Now - player.StartTime).Seconds, player);
    }
예제 #22
0
    public void SelectSave()
    {
        SEAttributes player = SaveSEAttributes.LoadPlayer();

        SaveSEAttributes.SavePlayer(player);
    }