Example #1
0
    IEnumerator Swan()
    {
        yield return(new WaitForSeconds(1.2f));

        while (Started)
        {
            yield return(new WaitForSeconds(1.8f));

            Audio.HandlePlaySoundAtTransform("Swan", transform);
        }
    }
    private IEnumerator GiveStrike(Transform wall, Transform from, Transform to)
    {
        BombModule.LogFormat("Tried to move from {0} to {1} - {2}, but there was a wall in the way. Strike", GetCoordinates(from),
                             GetCoordinates(to), GetDirection(from, to));


        var hitWall  = 8;
        var moveFrom = new Vector3(from.parent.transform.localPosition.x, StatusLight.localPosition.y, from.localPosition.z);
        var moveto   = new Vector3(to.parent.transform.localPosition.x, StatusLight.localPosition.y, to.localPosition.z);
        var movement = (moveto - moveFrom) / 4 / hitWall;

        for (var i = 0; i < hitWall; i++)
        {
            StatusLight.localPosition += movement;
            yield return(null);
        }
        StartCoroutine(ShowWall(wall.gameObject.GetComponent <MeshRenderer>()));
        if (!_unicorn)
        {
            FakeStatusLight.HandleStrike();
        }
        else
        {
            FakeStatusLight.FlashStrike();
            TwitchPlays.CauseFakeStrike(BombModule);
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
        }
        Audio.HandlePlaySoundAtTransform(GlassBreak.name, transform);
        for (var i = 0; i < hitWall; i++)
        {
            StatusLight.localPosition -= movement;
            yield return(null);
        }

        yield return(new WaitForSeconds(0.5f));

        _strikePending = false;
    }