Beispiel #1
0
 public void SpawnWeapon(WorkManager.Job j)
 {
     sword = Instantiate(j.Weapon);
     sword.transform.position = GetSwordTeleportPoint(WorkManager.TaskType.None).position;
     sword.transform.rotation = GetSwordTeleportPoint(WorkManager.TaskType.None).rotation;
     GetJobEvent?.Invoke(j);
     gotJob = true;
 }
Beispiel #2
0
 private void OnStartJob(WorkManager.Job job)
 {
     timeLimit   = job.Time;
     timeLeft    = timeLimit;
     quarterMark = timeLimit * 0.25f;    //get 25% of time
     //Debug.Log("Do it in " + job.Time + " seconds");
     working = true;
 }
Beispiel #3
0
    /// <summary>
    /// Move the music to the next stage which results in more instruments being added
    /// </summary>
    public void NextStage(WorkManager.Job job)
    {
        //type;
        float currentTime = Time.realtimeSinceStartup - startTime;

        if (Mathf.FloorToInt(currentTime / measureLength) > currentLoop)
        {
            currentLoop++;
        }

        currentStage++;

        //InitializeAudioSources(ChooseClipsToPlay(true), true);
    }
Beispiel #4
0
    private void SpawnCustomerModel()
    {
        //a customer needs a job :)
        currentJob = WorkManager.Instance.ChooseJob();
        player.RemoveSword();

        if (customerModel)
        {
            Destroy(customerModel);
            customerModel = null;
        }

        customerModel = Instantiate(currentJob.CustomerModel);
        customerModel.transform.position = new Vector3(transform.position.x, transform.position.y, 13f);
        customerModel.transform.DOMove(transform.position, 1f).onComplete += CustomerArrived;
    }
Beispiel #5
0
 public void ReceiveJob(WorkManager.Job j)
 {
     job = j;
 }
Beispiel #6
0
    private void EvaluateWeapon(WorkManager.Job job, Dictionary <WorkManager.TaskType, float> results)
    {
        float totalResults = results.Count;

        foreach (WorkManager.TaskType taskType in results.Keys)
        {
            print(taskType);
        }

        foreach (float offset in results.Values)
        {
            print(offset);
            totalResults -= offset;
        }

        float score = totalResults / results.Count;

        float grade = score * 10;

        int killInt;

        if ((int)grade <= 6)
        {
            //Add the grade amount of 1s to the list
            List <int> probability = new List <int>();
            for (int i = 0; i < (int)grade; i++)
            {
                probability.Add(1);
            }
            //Add 3 zeroes to the list
            for (int i = 0; i < 3; i++)
            {
                probability.Add(0);
            }

            //when you get a 6, customer has 1/3 chance to die
            //chance to die gets higher as grade gets lower because of less 1s in the list

            //killInt = probability[UnityEngine.Random.Range(0, probability.Count)];
            killInt          = 1;
            customerCounter -= killInt;

            //probably display some text for this
            if (killInt > 0)
            {
                customerDeathPopup.rectTransform.DOAnchorPosY(-85f, 1f).onComplete += CustomerDeathPopupBehaviour;
            }

            if (customerCounter <= 0)
            {
                gameoverScreen.rectTransform.DOScale(Vector3.one, 1f);
                return;
            }
        }


        customerCount.text = customerCounter + "/" + maxCustomers + " Customers";

        string message = (int)grade + "/10";

        string ending = GetEnding(score) + " " + message;

        ResultTextMadeEvent?.Invoke(ending);
        StartCoroutine(EvaluationTime());
    }
Beispiel #7
0
 private void Reset(WorkManager.Job job, Dictionary <WorkManager.TaskType, float> info)
 {
     text.text = "";
 }
Beispiel #8
0
 private void OnStartJob(WorkManager.Job job)
 {
     //not sure if these are needed but its convenient
 }
Beispiel #9
0
 private void OnEndJob(WorkManager.Job job, Dictionary <WorkManager.TaskType, float> results)
 {
 }
Beispiel #10
0
 private void OnDisplayJob(WorkManager.Job job)
 {
     Debug.Log("Display job desc");
     text.text = job.Description;
 }