public void emitActivitySign() { //print("emitactivity"); GameObject target = tMemory.GetItem <GameObject>("myTarget"); if (target == null) { //print("TARGET NULL MAYDAY MAYDAY"); return; } if (tMemory.GetItem <bool>("suicidaire")) { SignEmitter.Create(this.transform.position, SignType.Death, 1); } else if (tMemory.GetItem <bool>("wander")) { SignEmitter.Create(this.transform.position, SignType.Cellphone, 1); } else if (tMemory.GetItem <bool>("enDeplacement")) { if (target.CompareTag("Repos")) { //SignEmitter.Create(this.transform.position, SignType.GoingToGlande); } if (target.CompareTag("WorkHelp") || target.CompareTag("Box")) { //SignEmitter.Create(this.transform.position, SignType.GoingToWork); } } else if (tMemory.GetItem <bool>("auTravail")) { SignEmitter.Create(this.transform.position, target.GetComponent <InteractWithEmployee>().signToEmitWork, 1); } else { SignEmitter.Create(this.transform.position, target.GetComponent <InteractWithEmployee>().signToEmitChill, 1); } }
public IEnumerator Engueulade() { float currentYellingOMeter = yellingO_Meter; float top = Mathf.Min(maxLossByScream, yellingO_Meter); animator.SetTrigger("chargingHatarake"); actionArea.gameObject.SetActive(true); float pos = 0; float time = 0; moveLocked = true; while (charge) { time = time + Time.deltaTime; pos = Mathf.Lerp(jaugeEngueulageMin, jaugeEngueulageMin + jaugeEngueulageMax * (top / maxLossByScream), time / (tempsRemplissageJauge * (top / maxLossByScream))); actionArea.localScale = new Vector3(pos, actionArea.localScale.y, pos); yield return(null); } int yellingO_OnEight = (int)(((pos - jaugeEngueulageMin) / jaugeEngueulageMax) * 8); //print("yellingO_OnEight : " + yellingO_OnEight); if (yellingO_OnEight == 0) { yellingO_OnEight = 1; } //print("yellingO_OnEight * maxYellingO_Meter / 8" + yellingO_OnEight * maxYellingO_Meter / 8); //yellingO_Meter = yellingO_Meter - yellingO_OnEight * maxYellingO_Meter / 8; yellingO_Meter = yellingO_Meter - yellingO_OnEight; //print("yellingO_Meter : " + yellingO_Meter); //Sign.Create(pos, this.transform.position, SignType.Hatarake); SignEmitter.Create(this.transform.position, SignType.Hatarake, pos); if (yellingO_OnEight > 6) { GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().shaking = true; GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().shakeMagnitude = pos; GameObject audio = this.transform.Find("hatarake_strong").gameObject; audio.GetComponent <AudioSource>().Play(); } else if (yellingO_OnEight > 1) { GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().shaking = true; GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().shakeMagnitude = pos; GameObject audio = this.transform.Find("hatarake_medium").gameObject; audio.GetComponent <AudioSource>().Play(); } else if (yellingO_OnEight > 0) { GameObject audio = this.transform.Find("hatarake_low").gameObject; audio.GetComponent <AudioSource>().Play(); } actionArea.gameObject.SetActive(false); actionArea.localScale = new Vector3(0.8f, actionArea.localScale.y, 0.8f); //ResetTimer // jaugeEngueulage = 0; List <GameObject> employesEngueulable = actionArea.GetComponent <jaugeEngueulage>().getEmployesJauge(); foreach (GameObject emp in employesEngueulable) { if (emp.GetComponent <Decrasseur>() != null) { emp.GetComponent <Decrasseur>().Engueule(); } else { emp.GetComponent <Employe>().Engueule(); } } if (GameManager.instance.tutoIsOn && GameManager.instance.goingToHatarakeSlacker) { if (employesEngueulable.Count >= 1) { GameManager.instance.TutoEmployeeHataraked(); } } actionArea.GetComponent <jaugeEngueulage>().clearEmployesJauge(); animator.SetTrigger("releasingHatarake"); moveLocked = false; //actionArea.GetComponent<jaugeEngueulage>().Engueule(); }
public IEnumerator GrowingAreaOfEffect() { enumLock = true; print("~~~~~~~~ENTERING~~~~~~~~"); animator.SetTrigger("chargingHatarake"); ongoingHatarakading = true; //animator.SetTrigger("chargingHatarake"); actionArea.gameObject.SetActive(true); float pos = 0; float time = 0; moveLocked = true; while (ongoingHatarakading) { time = time + Time.deltaTime; if (maxVolumeLevel < microphone.loudness && maxVolumeLevel <= maxLoudness) { maxVolumeLevel = microphone.loudness; print("new maximum : " + maxVolumeLevel); } else if (microphone.loudness < seuilHatarake) { //ongoingHatarakading = false; } pos = Mathf.Lerp(0, Mathf.Max(jaugeEngueulageMin, maxVolumeLevel * jaugeEngueulageMax / maxLoudness), time / tempsRemplissageJauge); actionArea.localScale = new Vector3(pos, actionArea.localScale.y, pos); if (time > hatarakeTime) { print("--------------TimeOver---------------"); ongoingHatarakading = false; } if (!ongoingHatarakading) { maxVolumeLevel = 0; SignEmitter.Create(this.transform.position, SignType.Hatarake, pos); } yield return(null); } actionArea.gameObject.SetActive(false); actionArea.localScale = new Vector3(0.8f, actionArea.localScale.y, 0.8f); yellingO_Meter = 0; //------------------- // if (pos > 40) // { // GameManager.instance.cameraController.shaking = true; // GameManager.instance.cameraController.shakeMagnitude = pos; //GameObject audio = this.transform.Find("hatarake_strong").gameObject; //audio.GetComponent<AudioSource>().Play(); // } // else if (pos > 20) // { GameManager.instance.cameraController.shaking = true; GameManager.instance.cameraController.shakeMagnitude = pos; //GameObject audio = this.transform.Find("hatarake_medium").gameObject; //audio.GetComponent<AudioSource>().Play(); //} actionArea.gameObject.SetActive(false); actionArea.localScale = new Vector3(0.8f, actionArea.localScale.y, 0.8f); //ResetTimer // jaugeEngueulage = 0; List <GameObject> employesEngueulable = actionArea.GetComponent <jaugeEngueulage>().getEmployesJauge(); foreach (GameObject emp in employesEngueulable) { if (emp.GetComponent <Decrasseur>() != null) { emp.GetComponent <Decrasseur>().Engueule(); } else { emp.GetComponent <Employe>().Engueule(); } } if (GameManager.instance.tutoIsOn && GameManager.instance.goingToHatarakeSlacker) { if (employesEngueulable.Count >= 1) { GameManager.instance.TutoEmployeeHataraked(); } } actionArea.GetComponent <jaugeEngueulage>().clearEmployesJauge(); animator.SetTrigger("releasingHatarake"); print("~~~~~~~~LEAVING~~~~~~~~"); enumLock = false; onCoolDown = true; }