示例#1
0
    public static SignEmitter Create(Vector3 position, SignType type, float size)
    {
        Vector3    pos = new Vector3(position.x, position.y + 10, position.z);
        GameObject newObject;

        if (type != SignType.Hatarake)
        {
            newObject = Instantiate(SignGeneratorEmploye) as GameObject;
        }
        else
        {
            newObject = Instantiate(SignGeneratorBoss) as GameObject;


            //newObject.transform.localScale = newObject.transform.localScale * size * 50;
        }

        newObject.transform.position = pos;
        SignEmitter yourObject = newObject.GetComponent <SignEmitter>();

        yourObject.type           = type;
        yourObject.size           = size;
        yourObject.partiSysRender = newObject.GetComponent <ParticleSystemRenderer>();
        yourObject.partiSys       = newObject.GetComponent <ParticleSystem>();
        if (type == SignType.Hatarake)
        {
            yourObject.partiSys.startSize = yourObject.partiSys.startSize * size;
        }
        //do additional initialization steps here

        return(yourObject);
    }
示例#2
0
    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);
        }
    }
示例#3
0
    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();
    }
示例#4
0
    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;
    }