Example #1
0
    public override IEnumerator AttackLong()
    {
        attackTimer = 0.0f;
        while (attackTimer < LONG_ATTACK_WINDUP)
        {
            attackTimer += Time.deltaTime;
            yield return(null);
        }

        // Create projectile (musicNote)
        GameObject mNote = Instantiate(musicNote,
                                       transform.parent.position + new Vector3(0, 0.1f), Quaternion.identity);
        MusicNote mnScript = mNote.GetComponent <MusicNote>();

        mnScript.playerRotationY   = transform.parent.rotation.y;
        mnScript.startTime         = (float)rand.NextDouble() * 0.4f;
        mnScript.oscillationPeriod = (float)rand.NextDouble() * 1.5f + 2.5f;
        mnScript.setSpeed((float)rand.NextDouble() * 1.8f + 5.8f);
        mNote.SetActive(true);
    }