Ejemplo n.º 1
0
    void TestSpawn()
    {
        if (player != null && PrefabHelicopter != null && helicopterMainPoint != null)
        {
            if (player.gameplayParametrs.get_lvl_now() >= 3 && !timeToSpawnGo)
            {
                timeToSpawnGo = true;
            }


            //если сейчас нету живого вертолета
            if (helicopterLiveNow == null || (helicopterLiveNow != null && helicopterLiveNow.GetComponent <PiiTarget>().heath <= 0))
            {
                //Если время запущено
                if (timeToSpawnGo)
                {
                    timeToSpawn -= Time.deltaTime;

                    //и дошло до нуля
                    if (timeToSpawn < 0)
                    {
                        timeToSpawn = 0;

                        //Спавним вертолет
                        helicopterLiveNow = Instantiate <GameObject>(PrefabHelicopter, gameObject.transform).GetComponent <helicopter>();
                        helicopterLiveNow.setNewTarget(helicopterMainPoint.gameObject);
                        helicopterLiveNow.gameObject.transform.position = gameObject.transform.position;

                        //Отсрачиваем время появления следующего
                        if (player.gameplayParametrs.get_lvl_now() == 3)
                        {
                            timeToSpawn = Random.Range(0, 30);
                        }
                        else if (player.gameplayParametrs.get_lvl_now() == 4)
                        {
                            timeToSpawn = Random.Range(0, 60);
                        }
                        else if (player.gameplayParametrs.get_lvl_now() == 5)
                        {
                            timeToSpawn = Random.Range(0, 90);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 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);
                }
            }
        }
    }
Ejemplo n.º 3
0
 void Start()
 {
     instance = this;
 }