Example #1
0
 void Awake()
 {
     m_audioSourceArray = GetComponents <AudioSource>();
     for (int i = 0; i < m_lengthOfSoundArray; i++)
     {
         m_audioBehaviorArray[i] = AudioBehavior.CreateNewAudioBehavior(m_audioSourceArray[i]);
     }
     m_audioBehaviorArray[0].InitLerp(0, 1, m_lerpTime);
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     CSM = GameObject.Find("BattleManager").GetComponent <CombatStateMachine>();
     CSM.graphicPanel.GetComponent <Animator>().SetInteger("graphic", 4);
     totalRotation = 0;
     audioRef      = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
     target.Rotate(Vector3.forward * Random.Range(0, 7) * 22.5f);
     primed       = false;
     waitTime     = 0;
     currentState = State.ACTIVE;
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     audioRef = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
     noteTail = Instantiate(noteTail, transform.position, noteTail.rotation);
     noteTail.SetParent(transform);
     noteTail.gameObject.GetComponent <SpriteRenderer>().size = new Vector2(noteTail.transform.GetComponent <SpriteRenderer>().size.x, tailLength);
     noteTail.position = new Vector3(noteTail.position.x, noteTail.position.y + tailLength / 2 - 0.14f);
     animator          = noteTail.gameObject.GetComponent <Animator>();
     GetComponent <Rigidbody2D>().velocity = new Vector3(0, -audioRef.moddedNoteVelocity, 0);
     stage  = 0;
     passed = false;
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        //Movement
        //////////
        controls = GetComponent <PlayerControls>();
        animator = GetComponentInChildren <Animator>();
        speed    = maxSpeed;

        kurentAudio = GetComponentInChildren <AudioBehavior>();

        //Gameplay atributes
        ////////////////////
        temperature = 0.5f;
        stamina     = 0.5f;

        ///
        nearJurij = false;
        dead      = false;
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        audioRef        = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
        startTime       = audioRef.trackTime;
        boardTransform  = GetComponent <Transform>();
        crunderDistance = -2.6f;
        offset          = 0;
        noteCounter     = 0;
        firstTime       = (startTime + audioRef.SPB * audioRef.BPB - ((5.2f - crunderDistance - 0.4f) / audioRef.noteVelocity)) % audioRef.GetComponent <AudioSource>().clip.length;
        done            = false;
        move            = false;

        noteMap = new float[, ]
        {
            { 0.1f, 0, 0, 0, 0, 0, 1 / 4f },
            { 0, 0.1f, 0, 0, 0, 0, 1 / 4f },
            { 0, 0, 0.1f, 0, 0, 0, 1 / 4f },
            { 0, 0, 0, 0.1f, 0, 0, 1 / 4f },
            { 0.1f, 0, 0, 0, 0, 0.1f, 1 / 2f },
            { 0, 0, 0.1f, 0, 0.1f, 0, 1 / 2f },
            { 1, 0, 0, 0, 0, 0, 1 },
            { 0, 1, 1, 0, 0, 0, 1 },
            { 1, 0, 0, 1, 0, 0, 1 },
            { 0, 1, 0, 0, 1, 0, 1 },
            { 1f, 0, 0, 0.1f, 0, 0, 1 / 4f },
            { 0, 0, 0, 0, 0.1f, 0, 1 / 8f },
            { 0, 0, 0, 0, 0, 0.1f, 1 / 8f },
            { 0, 0, 0, 0, 0.1f, 0, 1 / 4f },
            { 0, 0, 0, 0.1f, 0, 0, 1 / 4f },
            { 0, 0, 0, 0, 0.1f, 0, 1 / 4f },
            { 0, 0, 0, 0.1f, 0, 0.1f, 1 / 4f },
            { 0, 0, 0, 0.1f, 0, 0.1f, 1 / 4f },
            { 0, 0, 0, 0.1f, 0, 0.1f, 1 / 4f },

            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
            { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 1 / 8f },
        };

        if (noteMap != null)
        {
            typenotelast  = noteMap[0, 6];
            noteMap[0, 6] = firstTime;
        }
        for (int i = 1; i < noteMap.GetLength(0); i++)
        {
            typenotenext  = noteMap[i, 6];
            noteMap[i, 6] = (noteMap[i - 1, 6] + 60 * (4 * typenotelast) / (audioRef.BPM)) % audioRef.GetComponent <AudioSource>().clip.length;
            typenotelast  = typenotenext;
        }

        destroyTime = (noteMap[noteMap.GetLength(0) - 1, 6] + (60f * audioRef.BPB / audioRef.BPM) + ((5.2f - crunderDistance - 0.4f) / audioRef.noteVelocity)) % audioRef.GetComponent <AudioSource>().clip.length;
        moveTime    = (noteMap[noteMap.GetLength(0) - 1, 6] + ((5.2f - crunderDistance - 0.4f) / audioRef.noteVelocity)) % audioRef.source.clip.length;

        Instantiate(C1, new Vector3(C1.position.x, boardTransform.position.y + crunderDistance, C1.position.z), C1.rotation).parent = boardTransform;
        Instantiate(C2, new Vector3(C2.position.x, boardTransform.position.y + crunderDistance, C2.position.z), C2.rotation).parent = boardTransform;
        Instantiate(C3, new Vector3(C3.position.x, boardTransform.position.y + crunderDistance, C3.position.z), C3.rotation).parent = boardTransform;
        Instantiate(C4, new Vector3(C4.position.x, boardTransform.position.y + crunderDistance, C4.position.z), C4.rotation).parent = boardTransform;
        Instantiate(C5, new Vector3(C5.position.x, boardTransform.position.y + crunderDistance, C5.position.z), C5.rotation).parent = boardTransform;
        Instantiate(C6, new Vector3(C6.position.x, boardTransform.position.y + crunderDistance, C6.position.z), C6.rotation).parent = boardTransform;

        //Instatiate all notes with negative spawntimes
        while (noteMap[noteCounter, 6] < startTime && noteMap[noteCounter, 6] + (audioRef.BPB + 1) * audioRef.SPB > startTime)
        {
            offset = (noteMap[noteCounter, 6] - startTime) * audioRef.noteVelocity;
            for (int i = 0; i < 6; i++)
            {
                if (noteMap[noteCounter, i] != 0)
                {
                    tailLength = noteMap[noteCounter, i];
                    if (tailLength == 0.1f)
                    {
                        Instantiate(Note, new Vector3(Note.position.x - 1.5f + 0.6f * i, boardTransform.position.y + 5.2f + offset), Note.rotation).parent = boardTransform;
                    }
                    else
                    {
                        Transform blarg = Instantiate(LongNote, new Vector3(LongNote.position.x - 1.5f + 0.6f * i, boardTransform.position.y + 5.2f + offset), LongNote.rotation);
                        blarg.SetParent(boardTransform);
                        blarg.gameObject.GetComponent <NoteLongBehavior>().tailLength = 60 * audioRef.SPB * tailLength / audioRef.noteVelocity;
                    }
                }
            }
            noteCounter++;
            if (noteCounter >= noteMap.GetLength(0))
            {
                done = true; break;
            }
        }
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     sr       = GetComponent <SpriteRenderer>();
     audioRef = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
 }
 // Use this for initialization
 void Start()
 {
     audioRef     = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
     CSM          = GameObject.Find("BattleManager").GetComponent <CombatStateMachine>();
     currentState = states.BEGIN;
 }
Example #8
0
 // Use this for initialization
 void Start()
 {
     passed   = false;
     audioRef = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
     GetComponent <Rigidbody2D>().velocity = new Vector3(0, -audioRef.moddedNoteVelocity, 0);
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     objectname = gameObject.name;
     anim       = GetComponent <Animator>();
     audioRef   = GameObject.Find("AudioManager").GetComponent <AudioBehavior>();
 }