Esempio n. 1
0
    private void Update()
    {
        if (jsonMode)
        {
            player.SetIsInteracting(true);
        }
        if (!jsonMode && player && (current == null || (!current.bounds.contains(player.transform.position) && !player.GetIsOscillating())))
        {
            AttemptSectorLoad();
        }

        // deadzone damage
        if (current && current.type == Sector.SectorType.DangerZone)
        {
            if (dangerZoneTimer >= 5 && !player.GetIsDead())
            {
                dangerZoneTimer = 0;
                Instantiate(damagePrefab, player.transform.position, Quaternion.identity);
                player.TakeShellDamage(0.2F * player.GetMaxHealth()[0], 0, null);
                player.TakeCoreDamage(0.2F * player.GetMaxHealth()[1]);
                player.alerter.showMessage("WARNING: Leave Sector!", "clip_stationlost");
            }
            else
            {
                dangerZoneTimer += Time.deltaTime;
            }
        }
        else
        {
            dangerZoneTimer = 0;
        }

        if (!DialogueSystem.isInCutscene)
        {
            bgSpawnTimer += Time.deltaTime;

            if (bgSpawnTimer >= 8 && bgSpawns.Count > 0)
            {
                bgSpawnTimer = 0;
                var key        = bgSpawns[Random.Range(0, bgSpawns.Count)];
                var spawnPoint = player.transform.position + Quaternion.Euler(0, 0, Random.Range(0, 360)) * new Vector3(key.Item4, 0, 0);
                key.Item2.position = spawnPoint;
                key.Item2.ID       = "";
                SpawnEntity(key.Item1, key.Item2);
                AudioManager.PlayClipByID("clip_respawn", spawnPoint);
            }
        }
    }