Example #1
0
    protected override void Death(Entity killer)
    {
        _currentDeathCount++;
        SetCurrentHealthBar();

        // VirusTriggerer has reach last position
        if (_currentDeathCount >= _deathCountToReleaseVirus || _debugInstantKill)
        {
            killer.OnKillMade?.Invoke(killer, this);
            TriggerVirus(killer);

            CameraShake.Instance.Shake(0.3f, 0.15f);
            CameraEffectController.Instance.EnableGlitch(true);

            CameraEffectController.Instance.ExecuteAfterTime(_glitchEffectDuration, ()
                                                             => CameraEffectController.Instance.EnableGlitch(false));

            float lifetime = Time.time - _instanciatedTime;
            ExtendedAnalytics.SendEvent("Virus Spawner Killed", new Dictionary <string, object>
            {
                { "Lifetime", lifetime }
            });
        }
        else
        {
            var newPosition = LevelDataLocator.GetLevelData().GetRandomVirusSpawnerPosition(transform.position);
            GetComponent <FancyObject>()?.ResetStartingPosition(newPosition);

            _hp = MaxHp;
            UpdateHealthSlider();

            CameraShake.Instance.Shake();
        }
    }
    private void InstantiateVirusSpawner()
    {
        if (_disableVirusSpawnerInstancing)
        {
            return;
        }

        // prevent spawning another virus spawner
        if (_currentVirusSpawner != null)
        {
            return;
        }

        ExtendedAnalytics.SendEvent("Virus Spawner Instanciated", new Dictionary <string, object>()
        {
            { "Kill count", GameManager.Instance.Gamemode.KillCount }
        });

        // prevent spawning if viruses are on the map
        if (FindObjectsOfType <VirusController>().Length != 0)
        {
            return;
        }

        var        position = LevelDataLocator.GetLevelData().GetRandomVirusSpawnerPosition();
        Quaternion rot      = Quaternion.identity;

        _currentVirusSpawner = Instantiate(_prefabVirusSpawner, position, rot);

        OnVirusSpawnerSpawned?.Invoke(_currentVirusSpawner.GetComponent <VirusSpawner>());
    }
Example #3
0
    private void SwitchWindowState()
    {
        _isWindowOpen = !_isWindowOpen;

        new Timer(this, TRANSITION_DURATION, (float t) =>
        {
            if (!_isWindowOpen)
            {
                t = -1 * t + 1; // reverse t parameter
            }

            _window.transform.localScale = Vector3.one * t;
            _window.transform.position   = transform.position + _deltaTargetPosition * t;

            for (int i = 0; i < _images.Length; i++)
            {
                _images[i].color.SetAlpha(t);
            }
        });

        ExtendedAnalytics.SendEvent("Shortcut Hit", new Dictionary <string, object>()
        {
            { "New Window State", _isWindowOpen ? "open" : "close" }
        });
    }
    void IPooledObject.OnObjectSpawn()
    {
        FancyObject.ResetStartingPosition(transform.position);

        ExtendedAnalytics.SendEvent("Projectile Pickup Spawn");

        OnSpawn?.Invoke();
    }
    void TriggerAnalyticEvent()
    {
        float duration     = (float)(System.DateTime.Now - _startTime).TotalSeconds;
        int   playersCount = GameManager.Instance.InstantiatedCharactersCount;

        ExtendedAnalytics.SendEvent("Party Ended", new Dictionary <string, object>()
        {
            { "Duration", duration },
            { "Players Count", playersCount },
            { "Party Finished", _isPartyFinished },
            { "Kill Goal", GameManager.Instance.Gamemode.ValueForVictory }
        });
    }
Example #6
0
    void Analytics_TriggerProjectileThrow(bool hasEnoughtAmmo)
    {
        return;

        // We disable this event:
        // We are limited to 100 events per hour and projectile are spammed.
        // Moreover, it's 'll disable sending of events with highest priority

        ExtendedAnalytics.SendEvent("Projectile Throw", new Dictionary <string, object>()
        {
            { "Has Enought Ammo", hasEnoughtAmmo },
            { "Thrower Char ID", charId.ToString() }
        });
    }
    void TakePickup(CharController takerCharController)
    {
        int ammoBeforeTaking = takerCharController.CurrentAmountProjectilesCarried;

        ExtendedAnalytics.SendEvent("Projectile Pickup Taken", new Dictionary <string, object>()
        {
            { "Taker Char ID", takerCharController.charId },
            { "Ammo Before Taking", ammoBeforeTaking }
        });

        takerCharController.FillCarriedProjectilesAmount();
        OnPickup?.Invoke();

        ObjectPooler.Instance.EnqueueGameObject("projectile_pickup", gameObject);
    }
 void OnDestroy()
 {
     ExtendedAnalytics.SendEvent("Projectile Pickup Destroy");
 }
 void Start()
 {
     ExtendedAnalytics.SendEvent("Projectile Pickup Spawn");
 }