Exemple #1
0
    public override IEnumerator StartInteraction()
    {
        selectionMade = 0;
        yield return(StartCoroutine(talkControl.StartDialogueSprite(travelDialogue[0], "default", 2, 10)));

        yield return(StartCoroutine(elevControl.StartElevator(currentLocation)));

        if (selectionMade == 0)
        {
            yield return(StartCoroutine(talkControl.StartDialogueSprite(stayDialogue, "default", 2, 10)));
        }
        else if (selectionMade == 2)
        {
            yield return(StartCoroutine(talkControl.StartDialogueSprite(alreadyHereDialogue, "default", 2, 10)));
        }
        else if (selectionMade == 3)
        {
            yield return(StartCoroutine(talkControl.StartDialogueSprite(cantDialogue, "default", 2, 10)));
        }
        else
        {
            yield return(StartCoroutine(talkControl.StartDialogueSprite(travelDialogue[1], "default", 2, 10)));

            elevator.StartShake(1f);
            yield return(new WaitForSeconds(1f));

            yield return(StartCoroutine(talkControl.StartDialogueSprite(travelDialogue[2], "default", 2, 10)));
        }
        selectionMade = 0;
    }
Exemple #2
0
    // 抖动指定控件
    // @param shake_obj 抖动对象
    // @param time 抖动时间
    // @param strength 抖动的力度(1左右刚好)
    public void Shake(Transform shake_obj, float time, float strength)
    {
        Shake shake = NGUITools.AddMissingComponent <Shake>(shake_obj.gameObject);

        shake.shakeTime = time;
        shake.strength  = strength;
        shake.StartShake();
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.CompareTag("character"))
        {
            if (isEnable == false)
            {
                return;
            }

            isEnable = false;
            shake.StartShake();
            Invoke("Break", 0.3f);

            SoundManager.Instance.PlaySFX(SFX.BreakBlock);
        }
    }
Exemple #4
0
    private void OnCollisionEnter(Collision collision)
    {
        GameObject other = collision.gameObject;

        if (other.layer == LayerMask.NameToLayer("Enemy"))
        {
            Enemy enemy = other.GetComponent <Enemy>();
            enemy.Die(collision.relativeVelocity);
            if (shake != null)
            {
                shake.StartShake();
            }
            else
            {
                Debug.LogWarning("Could not find shake object");
            }
        }
        if (other.layer == LayerMask.NameToLayer("Ground"))
        {
            audioSource.PlayOneShot(stompSounds[Random.Range(0, stompSounds.Count)], volume);
        }
    }
Exemple #5
0
 public void ShakePlayer(float duration, float distance, float delay)
 {
     shakeEffect.StartShake(duration, distance, delay);
 }
Exemple #6
0
    // Corutines:

    private IEnumerator UpdateHearts()
    {
        Color h0S  = heart_0.color;
        Color h0bS = heart_broken_0.color;
        Color h0E  = Color.black;
        Color h0bE = hurtColor;

        if (health >= 1)
        {
            h0E    = healthyColor;
            h0bE.a = 0;
        }
        if (h0bS.a > h0bE.a + 0.001f || h0bS.a < h0bE.a - 0.001f)
        {
            if (health >= 1)
            {
                heart_shake_0.StartShake(1.0f, 0.5f);
            }
            else
            {
                heart_shake_0.StartShake(0.15f, 0.33333f);
            }
        }
        Color h1S  = heart_1.color;
        Color h1bS = heart_broken_1.color;
        Color h1E  = Color.black;
        Color h1bE = hurtColor;

        if (health >= 2)
        {
            h1E    = healthyColor;
            h1bE.a = 0;
        }
        if (h1bS.a > h1bE.a + 0.001f || h1bS.a < h1bE.a - 0.001f)
        {
            if (health >= 2)
            {
                heart_shake_1.StartShake(1.0f, 0.5f);
            }
            else
            {
                heart_shake_1.StartShake(0.15f, 0.33333f);
            }
        }
        Color h2S  = heart_2.color;
        Color h2bS = heart_broken_2.color;
        Color h2E  = Color.black;
        Color h2bE = hurtColor;

        if (health >= 3)
        {
            h2E    = healthyColor;
            h2bE.a = 0;
        }
        if (h2bS.a > h2bE.a + 0.001f || h2bS.a < h2bE.a - 0.001f)
        {
            if (health >= 3)
            {
                heart_shake_2.StartShake(1.0f, 0.5f);
            }
            else
            {
                heart_shake_2.StartShake(0.15f, 0.33333f);
            }
        }

        yield return(HitchLib.Tweening.GenericTween(t => {
            float it = 1 - t;
            heart_0.color = it * h0S + t * h0E;
            heart_broken_0.color = it * h0bS + t * h0bE;
            heart_1.color = it * h1S + t * h1E;
            heart_broken_1.color = it * h1bS + t * h1bE;
            heart_2.color = it * h2S + t * h2E;
            heart_broken_2.color = it * h2bS + t * h2bE;
        }, 0.0f, 1.0f, 0.5f, HitchLib.Easing.EASE_QUAD_IN_OUT));

        aniCor = null;
    }
Exemple #7
0
 //Shake the screen
 public void ScreenShake(float duration, float magnitude)
 {
     camShaker.StartCoroutine(camShaker.StartShake(duration, magnitude));
 }