Example #1
0
    //For Customer
    void isCustomerDone()
    {
        //check for 70% timer or less.
        if (cust.dishWanted.Equals(readySalad))
        {
            //check for 70%.
            if (cust.healthBar.transform.localScale.x > 0.6f)
            {
                cust.isCusthappy   = true;
                cust.happyAtPlayer = this.PlayerID;
            }

            //update score.
            GameManager._scorePlayer1 += rightCombPoint;

            CustomerSpawner.DeleteCustomer(cust.ind);
            ClearChoppedVegeBoard(choppedVege);
        }
        else
        {
            // make customer Angry.
            cust.healthBar.GetComponentInChildren <SpriteRenderer>().color = Color.red;
            cust._rateOfDecresing = angryCustomerRate;
            cust.isCustAngry      = true;
            cust.angryAtPlayer    = this.PlayerID;
        }
    }
Example #2
0
    private void Update()
    {
        if (!isGenerated && !isMoving)
        {
            GenerateRandomString();
            currTime = timeToWait;
        }

        //updating Health and time to wait.
        if (!isMoving)
        {
            if (currTime > 0f)
            {
                UpdateHealthBar(healthBar);
                currTime -= _rateOfDecresing * Time.deltaTime;
            }
        }
        if (!isMoving && currTime <= 0f)
        {
            //reduce score for both players.
            Debug.Log("done");
            if (!isCustAngry)
            {
                GameManager._scorePlayer1 += custDisappointed;
                GameManager._scorePlayer2 += custDisappointed;
            }
            else if (isCustAngry && angryAtPlayer == 1)
            {
                GameManager._scorePlayer1 += custDisappointed * 2;
            }
            else if (isCustAngry && angryAtPlayer == 2)
            {
                GameManager._scorePlayer2 += custDisappointed * 2;
            }
            //and destroy the customer.
            CustomerSpawner.DeleteCustomer(ind);
        }
    }
Example #3
0
 public void DestroyCustomer(GameObject customer)
 {
     spawner.DeleteCustomer(customer);
 }