Beispiel #1
0
    //Оповещает игрока что нанести урон не получается
    public void TrigerPiiFail(GameObject score_Text_func)
    {
        TryTestPiiFall++;
        if (score_Text_func != null && TryTestPiiFall > 10)
        {
            if (score_text != null)
            {
                GameObject.Destroy(score_text);
            }

            score_text = Instantiate(score_Text_func);
            //score_text.transform.parent = gameObject.transform;
            Score_text_3d score_Text_3D = score_text.GetComponent <Score_text_3d>();

            if (heath > 0)
            {
                Color color_new = new Color(1f, 0.0f, 0, 0.9f);
                score_Text_3D.inicialize(player_save.gameObject, "X", gameObject.transform.position, color_new);
            }
        }
    }
Beispiel #2
0
    public void TrigerPii(float presure, FaceController faceController, PiiController piiController, GameObject score_Text_func)
    {
        //Если у мочи достаточно инерции и если у предмета еще есть здоровье
        if (presure >= MinPresure && heath != 0)
        {
            float score_plus_now = 0;

            if (heath > 0)
            {
                //Сперва проверяем напрягся ли игрок
                if (player_save != null && player_save.bolt.GetComponent <PiiController>().ChargeOn)
                {
                    heath -= presure;
                    if (!gameplayParametrs.GameOver)
                    {
                        score_plus_now = score * 1.5f;
                        player_save.PlusScore(score_plus_now);
                    }
                }
                else if (player_save != null && !player_save.bolt.GetComponent <PiiController>().ChargeOn)
                {
                    score_plus_now = score;
                    player_save.PlusScore(score_plus_now);
                }
                heath -= presure;

                if (heath < 0)
                {
                    heath = 0;
                }
                heath_percent = heath / (start_heath / 100);
                //Если есть частицы то воспроизводим их
                if (particle != null)
                {
                    particle.Play();
                }

                SetColorNeed(heath_percent);

                //Если здоровье закончилось
                if (heath <= 0)
                {
                    DeathTarget();
                    test_lvl_target(player_save.gameplayParametrs);

                    score_plus_now = score * score_destroy;
                    player_save.PlusScore(score_plus_now);

                    if (faceController != null && fear_emotion_dead && Random.Range(0, 100) < 50)
                    {
                        faceController.set_fear(3f);
                    }

                    helicopter helicopterObj = gameObject.GetComponent <helicopter>();
                    if (helicopterObj != null)
                    {
                        player_save.SetFullCharge();
                    }
                }
                //Иначе звук попадания
                else
                {
                    //Воспросизводим звук попадания
                    TargetSound sounds = gameObject.GetComponent <TargetSound>();
                    if (sounds != null)
                    {
                        gameObject.GetComponent <TargetSound>().PlaySoundPii();
                    }

                    //Если цель автомобиль воспроизводим сигнализацию
                    CarStatic CarSiren = gameObject.GetComponent <CarStatic>();
                    if (CarSiren != null)
                    {
                        CarSiren.StartSignal();
                    }
                    //Если цель полиция то запускаем сирену
                    police_car police = gameObject.GetComponent <police_car>();
                    if (police != null && !police.police_active_now)
                    {
                        police.police_active_now = true;
                        police.need_sound_yn     = true;
                    }
                }
            }

            if (faceController != null && !piiController.ChargeOn)
            {
                if (Random.Range(0, 100) < 1.1f)
                {
                    faceController.set_bliss_voice(1.2f);
                }
                if (Random.Range(0, 100) < 0.1f)
                {
                    faceController.set_surprise_voice(1.2f);
                }

                if (Random.Range(0, 100) < 0.1f && fear_emotion)
                {
                    faceController.set_choked_voice();
                }
            }


            if (score_Text_func != null)
            {
                if (score_text != null)
                {
                    GameObject.Destroy(score_text);
                }

                score_text = Instantiate(score_Text_func);
                Score_text_3d score_Text_3D = score_text.GetComponent <Score_text_3d>();

                ScoreSum += score_plus_now;
                //Проверка того что нужно написать в зависимости от здоровья
                if (heath > 0)
                {
                    Color color_new = new Color(1f, 0.92f, 0, 0.62f);
                    score_Text_3D.inicialize(player_save.gameObject, ((int)heath_percent).ToString() + "%", gameObject.transform.position, color_new);
                }
                else
                {
                    Color color_new = new Color(1f, 0.47f, 0, 0.62f);
                    score_Text_3D.inicialize(player_save.gameObject, ((int)ScoreSum).ToString(), gameObject.transform.position, color_new);
                }
            }
        }
    }