Exemple #1
0
    public override void Die(Transform killer = null, Audio sound = null, float volume = 1f)
    {
        if (Dead)
        {
            return;
        }

        Dead = true;
        Stickiness.Detach();
        Jumper?.CancelJump();

        if (killer != null)
        {
            Stickiness.Rigidbody.AddForce((Transform.position - killer.position).normalized * 10000);
        }

        if (sound != null)
        {
            _audioManager.PlaySound(_audioSource, sound, volume);
        }

        SetAllBehavioursActivation(false, false);
        StopDisplayGhosts();
        Renderer.color = ColorUtils.Red;
        _timeManager.StartSlowDownProgressive(.3f);

        if (DynamicInteraction.Interacting)
        {
            DynamicInteraction.StopInteraction(false);
        }



        StartCoroutine(Dying());
    }
Exemple #2
0
 private void Start()
 {
     _canvasTransform    = UICamera.Instance.Canvas.transform;
     _uiCamera           = UICamera.Instance.Camera;
     _hero               = Hero.Instance;
     _stickiness         = _hero?.Stickiness;
     _jumper             = _hero?.Jumper;
     _dynamicInteraction = _hero?.DynamicInteraction;
 }
Exemple #3
0
 public void SetInteractionActivation(bool active)
 {
     if (active)
     {
         DynamicInteraction.Activate();
     }
     else
     {
         DynamicInteraction.Deactivate();
     }
 }
Exemple #4
0
 protected virtual void Awake()
 {
     _dynamicEntity      = GetComponent <IDynamic>();
     _dynamicInteraction = GetComponent <DynamicInteraction>();
     _cameraBehaviour    = CameraBehaviour.Instance;
     _timeManager        = TimeManager.Instance;
     _stickiness         = GetComponent <Stickiness>();
     _poolManager        = PoolManager.Instance;
     _audioSource        = GetComponent <AudioSource>();
     _audioManager       = AudioManager.Instance;
     _initGravity        = _dynamicEntity.Rigidbody.gravityScale;
 }
Exemple #5
0
    private bool HeroSpawned()
    {
        //Waiting for hero to spawn
        if (_hero == null)
        {
            _hero = Hero.Instance;

            if (_hero == null)
            {
                return(false);
            }

            _stickiness         = _hero.Stickiness;
            _jumper             = _hero.Jumper;
            _dynamicInteraction = _hero.DynamicInteraction;
        }

        return(true);
    }