Beispiel #1
0
    /*void OnMouseDrag()
     * {
     *  //rb.position = GetMouseAsWorldPoint() + mOffset;
     *
     *  //rb.position = new Vector3(
     *  //    Mathf.Clamp(rb.position.x, -xRange, xRange),
     *  //    Mathf.Clamp(rb.position.y, -yRange, yRange),
     *  //    rb.position.z);
     *
     *  transform.position = GetMouseAsWorldPoint() + mOffset;
     *
     *  transform.position = new Vector3(
     *      Mathf.Clamp(transform.position.x, -xRange, xRange),
     *      Mathf.Clamp(transform.position.y, -yRange, yRange),
     *      transform.position.z);
     * }*/

    private void Hit()
    {
        // Subtract health
        health -= 15;

        // Tell health bar new health value.
        healthbar.SetHealth(health);

        // Camera effects.
        LeanTween.value(gameObject, (float i) => {
            CameraEffectsController.SetEffect(CameraEffectsController.Effect.ColorDrift, i);
            CameraEffectsController.SetEffect(CameraEffectsController.Effect.ScanLineJitter, i);
        }, 0.3f, 0f, 1f);

        LeanTween.value(gameObject, (float i) => {
            CameraEffectsController.SetEffect(CameraEffectsController.Effect.DigitalGlitch, i);
        }, 0.025f, 0f, 0.5f);
    }