// Use this for initialization void Start() { player2Script = GameObject.Find("Player 2").GetComponent <P2Movement> (); body2D = GetComponent <Rigidbody2D> (); body2D.bodyType = RigidbodyType2D.Dynamic; if (this.gameObject.tag == ("CrystalInteractable")) { body2D.bodyType = RigidbodyType2D.Kinematic; crystalLight = GetComponentInChildren <Light> (); crystalLight.enabled = false; } }
// Update is called once per frame void Update() { // Don't update if the game is over if (!CustomerSpawn.GameIsOver()) { // Decrease timer at rate determined by customer satisfaction timer -= Time.deltaTime * anger; // When timer elapses, customer leaves and deducts points in dissatisfaction if (timer <= 0.0) { if (anger == 1.0) { P1Movement.ScorePenalty(BASE_PENALTY * numIngredients); P2Movement.ScorePenalty(BASE_PENALTY * numIngredients); } // Determine which player(s) deserve(s) the penalty else { if (aScale > 0) { P1Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2); } else if (aScale < 0) { P2Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2); } else { P1Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2); P2Movement.ScorePenalty(BASE_PENALTY * numIngredients * 2); } } CustomerSpawn.SetOccupied(custID, false); Destroy(gameObject); } } }