void Awake()
 {
     instance      = this;
     scoreKeeper   = GetComponent <Score>();
     slowMotion    = GetComponent <SlowMotion>();
     bulletManager = GetComponent <BulletManager>();
 }
Beispiel #2
0
 void Awake()
 {
     share                 = this;
     _cachedTrans          = transform;
     _mode                 = "Sometimes";
     _cachedTrans.position = Vector3.zero;
 }
Beispiel #3
0
    private void DeathEffect()
    {
        SlowMotion.SlowTime(deathSlowdown, slowFadeIn, slowFadeOut);
        CameraHandler.ScreenShake(0.7f, 0.3f, 1f);
        if (deathEffect == null)
        {
            return;
        }
        var effect = Instantiate(deathEffect, transform.position, transform.rotation);

        effect.transform.parent = null;
        Destroy(effect, deathEffectLifetime);

        if (trail != null)
        {
            trail.transform.parent = null;
            trail.Stop();
            Destroy(trail, 10f);
        }

        if (isGameOverOnDeath)
        {
            LevelHandler.Instance.GameOver();
        }
    }
Beispiel #4
0
 void Start()
 {
     _screenShake = Camera.main.GetComponent <ScreenShake>();
     _knockback   = transform.root.GetComponent <Knockback>();
     _muzzleFlash = GetComponent <ParticleSystem>();
     _slowMotion  = transform.root.GetComponent <SlowMotion>();
 }
Beispiel #5
0
 private void OnCollisionEnter(Collision other)
 {
     if (other.collider.CompareTag("Floor") && _slowMotionEffect)
     {
         SlowMotion.StartSlowMotion();
     }
 }
Beispiel #6
0
    private void InitializeSlowMotionEffect()
    {
        playerSlowMotion = player.GetComponent <SlowMotion>();

        playerSlowMotion.OnSlowMotionActivated   += ShowSlowMotion;
        playerSlowMotion.OnSlowMotionDeActivated += HideSlowMotion;
    }
 public void ResetEnemy()
 {
     SlowMotion.DisableSlowMotion();
     transform.position = _startPosition;
     SetRagdollCollidersState(false);
     SetRigidbodiesState(true);
     _animator.enabled = true;
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Player"))
     {
         gameObject.SetActive(false); // Prevent double activation
         SlowMotion.StartSlowMotion();
         player.ActivateLaser();
     }
 }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        _mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> ();
        _slowMotion = _mainCamera.GetComponent <SlowMotion> ();
        _rigidbody  = GetComponent <Rigidbody> ();

        CrossHairRenderer.gameObject.SetActive(true);
        CrossHairRenderer.startWidth = 0;
    }
Beispiel #10
0
        void Start()
        {
            animator          = GetComponent <Animator>();
            audioSource       = GetComponent <AudioSource>();
            characterMovement = GetComponent <Character>();
            slowMotion        = Camera.main.GetComponent <SlowMotion>();

            currentHealthPoints = maximumHealthPoints;
        }
Beispiel #11
0
 public static void enemyKilled()
 {
     numberOfEnemies--;
     if (numberOfEnemies == 0)
     {
         playerManager.DisableLaser();
         SlowMotion.StopSlowMotion();
         playerManager.Reload();
     }
 }
Beispiel #12
0
 private void OnCollisionEnter(Collision collision)
 {
     Debug.Log("PlayerKilled");
     if (collision.gameObject.layer == LayerMask.NameToLayer("Player"))
     {
         SlowMotion.StopSlowMotion();
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
     //Destroy(gameObject);
 }
Beispiel #13
0
 private void PlayerRolled(CharacterController charController)
 {
     gameObject.layer = INV_LAYER;
     invTimer         = invTime;
     dodgeTimer       = dodgeCooldown;
     SlowMotion.SlowTime(0.3f, 0.2f, 0.6f);
     animator.SetTrigger("Dodge");
     dodgeEffect.Play();
     dodgeSound.pitch = Random.Range(0.9f, 1.1f);
     dodgeSound.Play();
 }
Beispiel #14
0
    private void Awake()
    {
        animation  = GetComponentInChildren <AnimationManager>();
        slowMotion = GetComponent <SlowMotion>();

        Dead = false;

        if (isPlayer)
        {
            movement  = GetComponent <MovementManager>();
            uiManager = GetComponent <UIManager>();
        }
    }
Beispiel #15
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.layer == LayerMask.NameToLayer("Enemy"))
     {
         Level.enemyKilled();
         collision.gameObject.SetActive(false);
     }
     Destroy(gameObject);
     if (collision.gameObject.layer == LayerMask.NameToLayer("Hostage"))
     {
         SlowMotion.StopSlowMotion();
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
 }
Beispiel #16
0
    public void changeHealth(int value)
    {
        int prevCurrentHealth = CurrentHealth;

        if (value == 0)
        {
            return;
        }

        if (value < 0 && (IsInvincible || IsEtherial))
        {
            //print("Casper is invincible");
            return;
        }
        CurrentHealth += value;
        if (CurrentHealth > MaxHealth)
        {
            CurrentHealth = MaxHealth;
        }
        if (CurrentHealth < 0)
        {
            CurrentHealth = 0;
        }

        if (CurrentHealth == 1)
        {
            StartCoroutine(SlowMotion.DoSlowMotion(5, 0.05f));
        }
        if (CurrentHealth <= 0)
        {
            StartCoroutine(SlowMotion.DoSlowMotion(2, 0.05f));
            StartCoroutine(Die());
        }
        onHealthChange?.Invoke(CurrentHealth);
        if (CurrentHealth > prevCurrentHealth)
        {
            CasperHealedEvent?.Invoke();
        }
        else if (CurrentHealth < prevCurrentHealth)
        {
            float invTimer = 2f;
            StartCoroutine(ToggleInvincibility(invTimer));
            StartCoroutine(FlashCasper(invTimer));
            Camera.main.GetComponent <CameraShake>().ShakeCamera(4f, 4f);
            CasperDamageEvent?.Invoke();
        }
    }
Beispiel #17
0
        // Creates an Event with the same properties as the given event
        public Event(Event other)
        {
            type                 = other.type;
            actionToPerform      = other.actionToPerform;
            basicActionToPerform = other.basicActionToPerform;
            soundEffect          = other.soundEffect;

            cameraMovement = new CameraMovement(other.cameraMovement);
            slowMotion     = other.slowMotion;
            particleEvent  = other.particleEvent;
            forceEvent     = new Force(other.forceEvent, false);
            colorFlash     = other.colorFlash;
            ghostEffect    = other.ghostEffect;
            screenShake    = other.screenShake;
            tweenEvent     = other.tweenEvent;

            startTime = other.startTime;
            duration  = other.duration;
        }
Beispiel #18
0
        void OnCollisionEnter(Collision collision)
        {
            GameObject   target       = collision.gameObject;
            HealthSystem healthSystem = target.GetComponent <HealthSystem>();
            SlowMotion   slowMotion   = Camera.main.GetComponent <SlowMotion>();

            if (healthSystem)
            {
                healthSystem.TakeDamage(damageToDeal);
                slowMotion.SlowTime();
                ParticleUtility.PlayParticleEffect(
                    target.transform,
                    particleEffectPrefab,
                    target.transform.position,
                    ParticleUtility.PARTICLE_STD_Y_OFFSET
                    );
            }


            Destroy(gameObject);
        }
Beispiel #19
0
 void Start()
 {
     gun        = GetComponentInChildren <Gun>();
     slowMotion = GetComponentInChildren <SlowMotion>();
 }
Beispiel #20
0
 private void Awake()
 {
     instance = this;
 }
Beispiel #21
0
 void Awake()
 {
     Instance = this;
 }
Beispiel #22
0
 // Start is called before the first frame update
 void Start()
 {
   SlowMotionButton.action.performed += HandleSlowMotionButtonPress;
   slowMotionScript = gameManager.GetComponent<SlowMotion>();
 }