Exemple #1
0
 void TestDelite()
 {
     if (piiTarget != null && piiTarget.heath > 0 && gameParam != null && gameParam.get_lvl_now() > 5)
     {
         Destroy(gameObject);
     }
 }
 public void in_the_dark()
 {
     if (gameplayParametrs != null && !gameplayParametrs.ThisDemoVersion)
     {
         if (gameplayParametrs != null && gameplayParametrs.get_lvl_now() <= 2)
         {
             bool resultYN = false;
             bool unloskYN = false;
             resultYN = SteamUserStats.GetAchievement(name_in_the_dark, out unloskYN);
             if (resultYN && !unloskYN)
             {
                 SteamUserStats.SetAchievement(name_in_the_dark);
                 to_server_ok = false;
             }
         }
     }
 }
    void TestSound()
    {
        if (audioSource != null && !audioSource.isPlaying)
        {
            //audioSource.volume = setings.game.volume_all * setings.game.volume_sound;
            audioSource.priority     = 2;
            audioSource.pitch        = Random.Range(0.95f, 1.05f);
            audioSource.spatialBlend = 1;
            audioSource.minDistance  = 10;
            audioSource.maxDistance  = 3000;

            audioSource.loop = true;
            audioSource.clip = mainWaterSound[Random.Range(0, mainWaterSound.Length)];
            audioSource.Play();
            //audioSource.PlayOneShot(mainWaterSound[Random.Range(0, mainWaterSound.Length)]);
        }
        if (audioSource != null && setings != null && gameParam != null)
        {
            //Расчитываем время с завершения игры
            if (gameParam.GameOver || gameParam.get_lvl_now() >= 6)
            {
                timeEndTsunami += Time.deltaTime;
            }

            float timeMinVolume = 20;

            float volumeCoof = 1;
            if (timeEndTsunami <= 0)
            {
                volumeCoof = 1;
            }
            else if (timeEndTsunami < timeMinVolume)
            {
                volumeCoof = 1 - (timeEndTsunami / timeMinVolume);
            }
            else
            {
                volumeCoof = 0;
            }

            if (setings != null && setings.game != null)
            {
                audioSource.volume = setings.game.volume_all * setings.game.volume_sound * volumeCoof;
            }
        }
    }
Exemple #4
0
    void TestTime()
    {
        lifeTime += Time.deltaTime;

        if (gameplayParametrs != null && (gameplayParametrs.GameOver || gameplayParametrs.get_lvl_now() > 5))
        {
            endTime += Time.deltaTime;
        }
    }
Exemple #5
0
    void testArrow()
    {
        if (gameplayParametrs != null && Arrow != null)
        {
            //Узнаем процент настоящий
            float percentOne = gameplayParametrs.TimeToEnd_max / 100;
            float percentNow = gameplayParametrs.TimeToEnd / percentOne;
            if (gameplayParametrs.TimeToEnd == 0 && gameplayParametrs.get_lvl_now() != 0)
            {
                percentNow = 0;
            }
            else if (gameplayParametrs.get_lvl_now() == 0)
            {
                percentNow = 100;
            }

            //Узнали сколько в процентах осталось Узнаем сколько это в градусах
            float gradOnePercent = (gradFull - gradEmpty) / 100;
            float gradNeed       = gradOnePercent * percentNow;

            //Получаем градусы стрелки сейчас и плавно двигаем
            float gradNow = Arrow.GetComponent <RectTransform>().rotation.eulerAngles.z;

            //Arrow.GetComponent<RectTransform>().Rotate(0,0, gradNow + ((gradNeed-gradNow) * Time.deltaTime));
            Quaternion RotateNew = new Quaternion();
            Arrow.GetComponent <RectTransform>().rotation = RotateNew;
            if (player != null && player.bolt.GetComponent <PiiController>().ChargeOn&& percentNow <= 55)
            {
                Arrow.GetComponent <RectTransform>().Rotate(0, 0, ((gradNeed + gradEmpty) + ((gradNeed + gradEmpty) - (gradNow)) * Time.deltaTime) + 25);
            }
            else
            {
                Arrow.GetComponent <RectTransform>().Rotate(0, 0, gradNeed + gradEmpty);
            }
        }
    }
    void testSpawn()
    {
        //Сперва проверяем есть ли вообще модель
        if (PrefabFlyer != null && gameplayParametrs != null && gameplayParametrs.get_lvl_now() >= lvl_start_spawn && gameplayParametrs.get_lvl_now() < lvl_end_spawn)
        {
            //Расчитываем пришло ли время или нет
            timeToSpawn -= Time.deltaTime;
            if (timeToSpawn <= 0)
            {
                timeToSpawn = Random.Range(randomTimeMin, randomTimeMax);

                GameObject flyer = Instantiate(PrefabFlyer);
                flyer.transform.position = transform.position;
                flyer.transform.rotation = transform.rotation;
            }
        }
    }
Exemple #7
0
    void testBoom()
    {
        if (!timePlay && particleBoom != null && gameplayParametrs != null && gameplayParametrs.get_lvl_now() == Lvl_boom)
        {
            timePlay = true;
        }

        //Нанести урон игроку
        if (!playerHit && timePlay && player != null)
        {
            float DistBoom = timeToBoom * -260;
            if (DistBoom > 1000)
            {
                playerHit = true;
                player.damageWindow.set_all_need(1, 1, 1, 1);
                //player.ScoreTime -= 1500;
                player.ScoreTime -= player.ScoreTime / 4;
            }
        }
    }
Exemple #8
0
    void TestSpawn()
    {
        timeToSpawnNow -= Time.deltaTime;
        if (timeToSpawnNow < 0)
        {
            timeToSpawnNow = 0;
        }

        if (gameplayParametrs != null && gameplayParametrs.get_lvl_now() >= 4 && timeToSpawnNow == 0)
        {
            timeToSpawnNow = Random.Range(20, 30);

            float distLastSpawn = 999;
            if (LastSpawnTank != null)
            {
                distLastSpawn = Vector3.Distance(LastSpawnTank.gameObject.transform.position, gameObject.transform.position);
            }

            if (distLastSpawn > 15 && numTanksSpawn < 6)
            {
                //+1 танк
                numTanksSpawn++;

                LastSpawnTank = Instantiate(PrefabTank);
                LastSpawnTank.transform.position = gameObject.transform.position;

                if (StartPoint != null)
                {
                    LastSpawnTank.target_track_point = StartPoint;
                    LastSpawnTank.transform.rotation.SetLookRotation(StartPoint.transform.position);
                }
                else
                {
                    LastSpawnTank.transform.rotation.SetLookRotation(player.transform.position);
                }
            }
        }
    }