Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        pt              = GameObject.Find("Pitch Tester").GetComponent <PitchTester>();
        gc              = GameObject.Find("Game Controller").GetComponent <GameController>();
        spriteRenderer  = GetComponent <SpriteRenderer>();
        playerTransform = GameObject.Find("Player").GetComponent <Transform>();

        trailRenderer = GetComponent <TrailRenderer>();
        trailRenderer.sortingOrder = 2;
        trailRenderer.startColor   = Color.black;
        trailRenderer.endColor     = Color.white;
        this.GetComponentInChildren <NoteText> ().isActive = gc.isTextActive;

        psInner = transform.GetChild(1).GetChild(0).GetComponent <ParticleSystem>();
        psOuter = transform.GetChild(1).GetChild(1).GetComponent <ParticleSystem>();
        psTrail = transform.GetChild(1).GetChild(2).GetChild(1).GetComponent <ParticleSystem>();

        var mainInner = psInner.main;

        psInner_startSize  = mainInner.startSizeMultiplier;
        psInner_startSpeed = mainInner.startSpeedMultiplier;
        var mainOuter = psOuter.main;

        psOuter_startSize  = mainOuter.startSizeMultiplier;
        psOuter_startSpeed = mainOuter.startSpeedMultiplier;
    }
Exemplo n.º 2
0
    void Awake()
    {
        Tolerance.text          = GameGlobals.GlobalInstance.LeniencyRange + "";
        GracePeriod.text        = GameGlobals.GlobalInstance.TransitionGracePeriod + "";
        InfNoteDen.text         = GameGlobals.GlobalInstance.NoteDensity + "";
        ScrollSpeed.text        = GameGlobals.GlobalInstance.TimeOnScreen + "";
        TBtwnRests.text         = GameGlobals.GlobalInstance.MaxTimeBetweenRests + "";
        VolThreshold.text       = GameGlobals.GlobalInstance.volumeThreshold + "";
        LowNote.text            = GameGlobals.GlobalInstance.getLowNote();
        HighNote.text           = GameGlobals.GlobalInstance.getHighNote();
        SongMode.interactable   = !GameGlobals.GlobalInstance.SongMode;
        InfMode.interactable    = GameGlobals.GlobalInstance.SongMode;
        BassClef.interactable   = !GameGlobals.GlobalInstance.bassClefMode;
        TrebleClef.interactable = GameGlobals.GlobalInstance.bassClefMode;
        plrRed            = GameGlobals.GlobalInstance.plrRed;
        plrGrn            = GameGlobals.GlobalInstance.plrGrn;
        plrBlu            = GameGlobals.GlobalInstance.plrBlu;
        redSlider.value   = plrRed;
        greenSlider.value = plrGrn;
        blueSlider.value  = plrBlu;
        changeColorIndicators();

        player         = GetComponent <AudioCuePlayer>();
        changeSettings = true;
        pt             = GameObject.Find("PitchTester").GetComponent <PitchTester>();
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     gc   = GameObject.Find("Game Controller").GetComponent <GameController>();
     pt   = GameObject.Find("Pitch Tester").GetComponent <PitchTester>();
     anim = GetComponent <Animator>();
     FillNoteLookup();
     deathParticle = GameObject.Instantiate(deathParticlePrefab).GetComponent <ParticleSystem>();
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     if (isActive)
     {
         note = GameObject.Find("Pitch Tester").GetComponent <PitchTester> ();
         text = this.GetComponent <TextMesh> ();
         GetComponent <MeshRenderer>().sortingLayerName = "Top";
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 5
0
    void Start()
    {
        if (GameGlobals.GlobalInstance != null)
        {
            GameGlobals temp = GameGlobals.GlobalInstance;
            isTextActive           = temp.isTextActive;
            TimeOnScreen           = temp.TimeOnScreen;
            NotesRange             = temp.NotesRange;
            BPM                    = temp.BPM;
            TransitionGracePeriod  = temp.TransitionGracePeriod;
            SustainedGracePeriod   = temp.SustainedGracePeriod;
            LeniencyRange          = temp.LeniencyRange;
            SongMode               = temp.SongMode;
            filename               = temp.selectedSong;
            speedMult              = temp.speedMult;
            scrollingInterpolation = temp.scrollingInterpolation;
            MaxTimeBetweenRests    = temp.MaxTimeBetweenRests;
            WritingOn              = temp.WritingOn;
            bassClefMode           = temp.bassClefMode;
            infiniteNoteDensity    = temp.NoteDensity;
            plrRed                 = temp.plrRed;
            plrGrn                 = temp.plrGrn;
            plrBlu                 = temp.plrBlu;
            volumeThreshold        = temp.volumeThreshold;
        }

        pt = GameObject.Find("Pitch Tester").GetComponent <PitchTester>();
        pt.volThreshold = volumeThreshold;
        audioPlayer     = GetComponent <AudioCuePlayer>();
        background      = GameObject.Find("Background");
        FillNotesAllowed();
        fg            = new FrequencyGuide();
        deathParticle = GameObject.Instantiate(deathParticlePrefab).GetComponent <ParticleSystem>();


        if (infiniteNoteDensity <= 1)
        {
            minNoteDuration = 2;
            maxNoteDuration = 4;
        }
        else if (infiniteNoteDensity == 2)
        {
            minNoteDuration = 1;
            maxNoteDuration = 3;
        }
        else if (infiniteNoteDensity == 3)
        {
            minNoteDuration = 1 / 8;
            maxNoteDuration = 2;
        }
        // If we're in Song mode, read in file information
        if (SongMode)
        {
            ReaderWriter.ReadSong(ref Song, filename, ref BPM, ref bassClefMode);
        }

        // Initialize tables
        if (bassClefMode)
        {
            BassClefTransformation();
        }
        fillGapsInPosColorLookup();
        fillNoteColorLookup();

        // Calculate conversion factors
        float screenWidthInWorldUnits = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, 0, 10)).x
                                        - Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 10)).x;

        worldUnitsPerSec  = screenWidthInWorldUnits / TimeOnScreen;
        worldUnitsPerBeat = worldUnitsPerSec * 60 / BPM;
        spawnPosOffset    = screenWidthInWorldUnits;

        // Add terminating rest to song mode
        if (SongMode)
        {
            for (int i = 1; i < Song.Count; i++)
            {
                if (Song[i].name == "REST")
                {
                    Song[i].yOffset = Song[i - 1].yOffset;
                }
                else
                {
                    Song[i].yOffset = notePosLookup[Song[i].name];
                }
            }

            Song.Add(new Note("REST", screenWidthInWorldUnits));
            Song[Song.Count - 1].yOffset = Song[Song.Count - 2].yOffset;
        }

        Player.GetComponent <SpriteRenderer>().color = new Color(plrRed, plrGrn, plrBlu, 1f);
        Bud.SetParticleBPM(BPM);

        if (warmupMode)
        {
            StartWarmup();
        }
        else
        {
            StartLevel();
        }
    }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     pt  = GameObject.Find("PitchTester").GetComponent <PitchTester>();
     img = GetComponent <Image>();
 }