//méthode destroy des beat du tableau de int pour que le foreach passe plus dans le début du json? #region Champs #endregion #region Propriétés #endregion public Beat(BeatType type, int BeatNumber) { this.type = type; this.BeatNumber = BeatNumber; DistanceFromRightBorder = 0; DecimalesDeplacement = 0; }
/// <summary> /// This method is called by each BeatCounter this object is observing. /// </summary> /// <param name="beatType">The beat type that invoked this method.</param> public void BeatNotify(BeatType beatType, int currentB, int beatInSqc) { beatMask |= beatType; currentBeat = currentB; beatInSequence = beatInSqc; StartCoroutine(WaitOnBeat(beatType)); }
public void SetBeatType(BeatType type) { //set internal beat type to passed-in type beatType = type; //change sprite to match beat type switch (beatType) { case BeatType.Up: GetComponent <SpriteRenderer>().sprite = typeSprites[0]; //GetComponent<Image>().sprite = typeSprites[0]; break; case BeatType.Down: GetComponent <SpriteRenderer>().sprite = typeSprites[1]; //GetComponent<Image>().sprite = typeSprites[1]; break; case BeatType.Left: GetComponent <SpriteRenderer>().sprite = typeSprites[2]; //GetComponent<Image>().sprite = typeSprites[2]; break; case BeatType.Right: GetComponent <SpriteRenderer>().sprite = typeSprites[3]; //GetComponent<Image>().sprite = typeSprites[3]; break; } }
private double GetTimeUntilBeat(byte delay, bool next, BeatType type) { if (delay == 0) { return(0); } var time = AudioSettings.dspTime; var nextTick = this._nextEventTime - time; if (next) { var typeTicks = (delay - 1) * this.TimeBetweenEvents * (int)type; var ticksUntilType = this.TimeBetweenEvents * ((int)type - (this._beatInBar + 2) % (int)type); var rawDelay = typeTicks + nextTick + ticksUntilType; return(rawDelay); } var fullTickDelay = delay * this.TimeBetweenEvents * (int)type - this.TimeBetweenEvents; var totalRawDelay = nextTick + fullTickDelay; var result = ((int)BeatType.Full - (this._beatInBar + 1)) * this.TimeBetweenEvents + totalRawDelay; var fullBar = this.TimeBetweenEvents * (int)BeatType.Full; return(result > fullBar ? result - fullBar : result); }
public BeatInfo(float b, BeatType t, bool p, float st) { beat = b; beatType = t; hasPriority = p; spawnTime = st; }
int IsBeat() { this.GetComponent <AudioSource> ().GetSpectrumData(spectrum0, 0, FFTWindow.BlackmanHarris); this.GetComponent <AudioSource> ().GetSpectrumData(spectrum1, 1, FFTWindow.BlackmanHarris); this.GetComponent <AudioSource> ().GetOutputData(frames0, 0); this.GetComponent <AudioSource> ().GetOutputData(frames1, 1); BeatType energy = BeatType.NONE; switch (beatMode) { case BeatMode.ENERGY: if (isBeatEnergy()) { return((int)BeatType.ENERGY); } break; case BeatMode.FREQUENCY: isBeatFrequency(); int val = (int)isKick() | (int)isSnare() | (int)isHat(); return(val); case BeatMode.BOTH: if (isBeatEnergy()) { energy = BeatType.ENERGY; } isBeatFrequency(); int val2 = (int)isKick() | (int)isSnare() | (int)isHat() | (int)energy; return(val2); } return(0); }
public void CreateNewBeat(BeatType beat) { myBeatType = beat; switch (myBeatType) { case BeatType.Normal: break; case BeatType.Up: gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/circleUp"); break; case BeatType.Down: gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/circleDown"); break; case BeatType.Left: gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/circleLeft"); break; case BeatType.Right: gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/circleRight"); break; case BeatType.Enemy: break; } }
public BeatInfo(Lane lane, BeatType type, float offset, float duration) { m_lane = lane; m_type = type; m_offset = offset; m_duration = duration; }
protected Beat(BeatType t, double start, double end, byte row) { this.T = t; this.StartTime = start; this.EndTime = end; this.Row = row; }
public BeatSequence(BeatType t, float i, float s, float e) { noteType = t; interval = i; startTime = s; endTime = e; }
private void handleReset() { Name.clearField(); Album.clearField(); Artist.clearField(); BPM.clearField(); BeatNum.clearField(); BeatType.clearField(); }
/// <summary> /// This method is called by each BeatCounter this object is observing. /// </summary> /// <param name="beatType">The beat type that invoked this method.</param> public void BarNotify(BeatType beatType) { //Debug.Log("Bar"); beatMask |= beatType; if (this.GetComponent <MusicNode>() != null) { this.GetComponent <MusicNode>().OnBar(); } StartCoroutine(WaitOnBeat(beatType)); }
/// <summary> /// This method is called by each BeatCounter this object is observing. /// </summary> /// <param name="beatType">The beat type that invoked this method.</param> public void BeatNotify(BeatType beatType) { //Debug.Log("Beat"); beatMask |= beatType; if (this.GetComponent <MusicNode>() != null) { this.GetComponent <MusicNode>().OnBeat(); } //BroadcastMessage("OnBeat"); StartCoroutine(WaitOnBeat(beatType)); }
BeatType isKick() { BeatType type = BeatType.NONE; int upper = 6 >= totalBfLen ? totalBfLen : 6; if (isRange(1, upper, 2)) { type = BeatType.KICK; } return(type); }
BeatType isHat() { BeatType type = BeatType.NONE; int lower = totalBfLen - 6 < 0 ? 0 : totalBfLen - 6; int upper = totalBfLen - 1; if (isRange(lower, upper, 1)) { type = BeatType.HITHAT; } return(type); }
BeatType isSnare() { BeatType type = BeatType.NONE; int lower = 8 >= totalBfLen ? totalBfLen : 8; int upper = totalBfLen - 5; int thresh = ((upper - lower) / 3) - 0; if (isRange(lower, upper, thresh)) { type = BeatType.SNARE; } return(type); }
public void NoteHit(BeatType beatType) { if (!gameRunning) { return; } float songPos = AudioSource.time; BeatInfo beatInfo = GetCurrentBeat(); Accuracy acc = Accuracy.Miss; // guilty until proven innocent // 1. FIND TIME DIFFERENCE BETWEEN BEAT TIME AND ACTUAL TIME float timingDifference = Mathf.Abs(beatInfo.beat - songPos); // 2. CHECK IF NEXT BEAT IS CLOSE ENOUGH TO BOTHER CHECKING FOR ACCURACY if (timingDifference >= attemptWindow) { return; } // 3. FIGURE OUT IF CORRECT BUTTON WAS HIT if (beatType == beatInfo.beatType) { // 4. GET ACCURACY BASED ON TIME DIFFERENCE if (timingDifference <= accuracyOk && timingDifference > accuracyGreat) { acc = Accuracy.Ok; } else if (timingDifference <= accuracyGreat) { acc = Accuracy.Great; } //Debug.Log("current time: " + songPos + "; timing diff: " + timingDifference + "; accuracy: " + acc); } // 4. DISPLAY RESULTS UI.ShowAccuracy(acc); NoteController.NoteHit(beatInfo.beat); Score.NoteHit(acc); // animate dumpling if we hit the note! if (acc != Accuracy.Miss) { DumplingAnimator.IncrementFrame(); NoteHitAudioSource.PlayOneShot(NoteHitClip, 1); } IncrementBeat(); }
private BeatType nextBeatType(BeatType thisBeatType) { if (thisBeatType == BeatType.INTRO) { return(BeatType.ROBOT_MOVE); } else if (thisBeatType == BeatType.ROBOT_MOVE) { return(BeatType.BOARD_MOVE); } else { return(BeatType.ROBOT_MOVE); } }
void Update() { BeatTimer += Time.deltaTime; if (BeatTimer > secondsPerBeat) { currentBeatType = nextBeatType(currentBeatType); BeatStartedSignal beatStartedSignal = new BeatStartedSignal(currentBeatType); if (currentBeatType == BeatType.ROBOT_MOVE && !gameIsOver) { MoveCompleted++; } GameSceneSignalManager.Inst.FireSignal(beatStartedSignal); BeatTimer = BeatTimer - secondsPerBeat; } }
public static Beat FromType(BeatType t) { switch (t) { case BeatType.Short: return(new ShortBeat(0, 0, 0)); case BeatType.Long: return(new LongBeat(0, 0, 0)); case BeatType.Drift: return(new DriftBeat(0, 0, 0, 0)); default: throw new ArgumentException(string.Format("BeatType `{0}` no recognized", t)); } }
// Main - Check if time to spawn a note, and make one if so. void Update() { if ((onBeat.beatMask != 0) && onBeat.beatMask != repeatCheck) { currentStep++; if (currentStep >= 6) { SpawnNewNote(); } //while (noteData[currentNote] == currentStep) //{ // currentNote++; //} } repeatCheck = onBeat.beatMask; }
public void Init( float beat, float speed, float dest, float past, BeatType beatType, TimingCounter timingCounter ) { this.beat = beat; this.speed = speed; this.dest = dest; distancePastGoal = past; this.TimingCounter = timingCounter; switch (beatType) { case BeatType.Up: SpriteRenderer.sprite = UpSprite; break; case BeatType.Down: SpriteRenderer.sprite = DownSprite; break; case BeatType.Left: SpriteRenderer.sprite = LeftSprite; break; case BeatType.Right: SpriteRenderer.sprite = RightSprite; break; default: Debug.LogError("unhandled beat type case"); break; } }
void Awake() { mySource = GetComponent <AudioSource>(); muffledSource = childSource; fourthNotesCounter = barLength; eighthNotesCounter = barLength * 2; sixteenthNotesCounter = barLength * 4; bps = bpm / 60; nextFourthSample = delay * mySource.clip.frequency; nextEighthSample = delay * mySource.clip.frequency; nextSixteenthSample = delay * mySource.clip.frequency; OnBeat = false; OnEighthBeat = false; OnSixteenthBeat = false; currentBeat = BeatType.NoBeat; barDuration = 1 / bps * barLength; firstBeatRange = (delay * mySource.clip.frequency) + (1 / bps * mySource.clip.frequency); audioFrequency = mySource.clip.frequency; }
void Update() { // If on the beat, decrement the wait time. if ((onBeat.beatMask != 0) && (onBeat.beatMask != repeatCheck)) { beatWait--; } repeatCheck = onBeat.beatMask; // Make the spider flash red when it's waiting to attack. this.GetComponent <SpriteRenderer>().color = spiderColor; if ((beatWait <= 6) && (beatWait != 0) && (beatWait % 2 == 0)) { this.GetComponent <SpriteRenderer>().color = new Color32(208, 144, 144, 255); } // Attack if it's time to do so. if (beatWait <= 0) { GameObject stringShot = Instantiate(stringSprite) as GameObject; beatWait = Random.Range(minBeat, maxBeat); } }
public virtual INotation Parse(string name, string input, BeatType beatType, InstrumentType instrumentType) { EnsureInput(input); var tokenizer = CreateTokenizer(); var tokens = tokenizer.Tokenize(input); if (beatType == BeatType.Unknown) { beatType = DetectBeatType(tokens); } var notation = CreateNotation(name, beatType, instrumentType); notation.RawNotation = input; EnsureTokens(name, tokens); EnsureMeasureLines(name, tokens); Parse(tokens, notation, beatType, instrumentType); return(notation); }
void Start() { beatMask = BeatType.None; }
//constructor public BeatInfo(Lane lane, BeatType type, float offset) { m_lane = lane; m_type = type; m_offset = offset; }
public BeatEntry(int _beat, int _duration, BeatType _type) { beat = _beat; duration = _duration; type = BeatType.Default; }
public Heartbeat(BeatType bType) { this.beatType = bType; }
void Start() { beatMask = BeatType.None; beatValue = BeatValue.None; }
/// <summary> /// This overloaded method is called by each PatternCounter this object is observing. Since pattern counters contain a sequence of /// different beat types, keeping track of the beat type isn't necessary. To test for a beat from the pattern counter, the beat mask /// should be checked for the BeatType.OnBeat flag. /// </summary> public void BarNotify() { beatMask |= BeatType.OnBeat; StartCoroutine(WaitOnBeat(BeatType.OnBeat)); }
/// <summary> /// This overloaded method is called by each PatternCounter this object is observing. Since pattern counters contain a sequence of /// different beat types, keeping track of the beat type isn't necessary. To test for a beat from the pattern counter, the beat mask /// should be checked for the BeatType.OnBeat flag. /// </summary> public void BeatNotify(BeatValue value) { beatValue = value; beatMask |= BeatType.OnBeat; StartCoroutine(WaitOnBeat(BeatType.OnBeat)); }
/// <summary> /// This method is called by each BeatCounter this object is observing. /// </summary> /// <param name="beatType">The beat type that invoked this method.</param> public void BeatNotify (BeatType beatType) { beatMask |= beatType; StartCoroutine(WaitOnBeat(beatType)); }
/// <summary> /// Clears the bit corresponding to the beat type after a specified duration of time. /// </summary> /// <param name="beatType">The beat type to clear.</param> IEnumerator WaitOnBeat (BeatType beatType) { yield return new WaitForSeconds(beatWindow / 1000f - 0.1f); beatMask ^= beatType; yield return new WaitForSeconds(0.1f); }
/// <summary> /// This overloaded method is called by each PatternCounter this object is observing. Since pattern counters contain a sequence of /// different beat types, keeping track of the beat type isn't necessary. To test for a beat from the pattern counter, the beat mask /// should be checked for the BeatType.OnBeat flag. /// </summary> public void BeatNotify () { beatMask |= BeatType.OnBeat; StartCoroutine(WaitOnBeat(BeatType.OnBeat)); }
/// <summary> /// Clears the bit corresponding to the beat type after a specified duration of time. /// </summary> /// <param name="beatType">The beat type to clear.</param> IEnumerator WaitOnBeat(BeatType beatType) { yield return(new WaitForSeconds(beatWindow / 1000f)); beatMask ^= beatType; }
void Start () { beatMask = BeatType.None; }