public float CheckLimbs(DanceMove currentMove, Players player) { float index = 0f; float score = 0f; if (player == Players.PlayerOne) {
public bool CompareMove(DanceMove m){ if (m.Equals (randomMoveSequence.Peek ())) { randomMoveSequence.Dequeue (); return true; } return false; }
public async Task <IActionResult> Edit(int id, [Bind("DanceMoveId,Name,DanceVideoId,SyllabusId")] DanceMove danceMove) { if (id != danceMove.DanceMoveId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(danceMove); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DanceMoveExists(danceMove.DanceMoveId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SyllabusId"] = new SelectList(_context.Syllabus, "SyllabusId", "SyllabusId", danceMove.SyllabusId); ViewData["DanceVideoId"] = new SelectList(_context.DanceVideo, "DanceVideoId", "DanceVideoId", danceMove.DanceVideoId); return(View(danceMove)); }
public void Create_ParsesCorrectPartners() { var move = DanceMove.GetInstance("pe/b") as PartnerMove; Assert.AreEqual('e', move.Partner1); Assert.AreEqual('b', move.Partner2); }
public void Create_ParsesCorrectExchange() { var move = DanceMove.GetInstance("x3/4") as ExchangeMove; Assert.AreEqual(3, move.SwapPosA); Assert.AreEqual(4, move.SwapPosB); }
private void playMove(DanceMove move){ if (!female.CompareMove (move)) { game.GameOver(); } movesTaken++; game.blockInput(AnimationLength()); move.Play (this); }
public void playSound(DanceMove move){ if (move == DanceMove.headMove) fMinor.Play (); else if (move == DanceMove.leftWingMove) aMinor.Play (); else if (move == DanceMove.rightWingMove) bMinor.Play (); else if (move == DanceMove.feetMove) dMinor.Play (); }
public void Init(DanceMove move, Sprite danceIcon, Quaternion dir, float phase) { _setup = true; _transform = GetComponent<RectTransform>(); _startPos = _transform.localPosition; _dir = dir; _time = phase / 20.0f; var render = GetComponent<Image>(); render.sprite = danceIcon; _danceId = move.Id; render.color = DancesExecuted.Instance.HasExecutedDance(_danceId) ? ActiveCol : InactiveCol; }
public void Dance_SwapsCorrectPartners() { var move = DanceMove.GetInstance("x3/4") as ExchangeMove; var dancers = new List <char> { 'a', 'b', 'c', 'd', 'e' }; var result = move.Dance(dancers); Assert.AreEqual('d', result[4]); Assert.AreEqual('e', result[3]); }
public void Dance_SwapsCorrectPartners() { var move = DanceMove.GetInstance("pe/b") as PartnerMove; var dancers = new List <char> { 'a', 'b', 'c', 'd', 'e' }; var result = move.Dance(dancers); Assert.AreEqual('b', result.Last()); Assert.AreEqual('e', result[1]); }
public void Dance_ShiftsCorrectAmount() { var move = DanceMove.GetInstance("s1") as SpinMove; var dancers = new List <char> { 'a', 'b', 'c', 'd', 'e' }; var result = move.Dance(dancers); Assert.AreEqual('e', result[0]); Assert.AreEqual('a', result[1]); }
public async Task <IActionResult> Create([Bind("DanceMoveId,Name,DanceVideoId,SyllabusId")] DanceMove danceMove) { if (ModelState.IsValid) { _context.Add(danceMove); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SyllabusId"] = new SelectList(_context.Syllabus, "SyllabusId", "SyllabusId", danceMove.SyllabusId); ViewData["DanceVideoId"] = new SelectList(_context.DanceVideo, "DanceVideoId", "DanceVideoId", danceMove.DanceVideoId); return(View(danceMove)); }
private void InitializeEntity(ref Unity.Mathematics.Random random, EntityManager manager, Entity entity) { var moves = manager.GetBuffer <DanceMove>(entity); DanceMove move = default; for (uint i = 0; i < danceLoopLength; ++i) { var values = random.NextFloat4() * 10f - 5f; move.Duration = values.w + 5f; move.Velocity = values.xyz; random.state = random.NextUInt(); moves.Add(move); } manager.SetComponentData(entity, new Velocity { Value = (random.NextFloat3() - 0.5f) * 8f }); }
// Use this for initialization void Start () { string name = gameObject.name; switch(name){ case "Head" : move = DanceMove.headMove; break; case "Left Wing" : move = DanceMove.leftWingMove; break; case "Right Wing" : move = DanceMove.leftWingMove; break; case "Feet" : move = DanceMove.feetMove; break; } button = gameObject.GetComponent<Button> (); game.registerButton (this); Disable (); }
private void SpawnMove() { bool spawnRequired = false; if (danceMoves.Count == 0) { spawnRequired = true; } if (timeSinceLastSpawn > 6.0f && Random.value > 0.0005f) { spawnRequired = true; } if (spawnRequired) { timeSinceLastSpawn = 0; int prefabIndex = Random.Range(0, danceMovePrefabs.Count - 1); DanceMove newDanceMove = new DanceMove(danceMovePrefabs[prefabIndex]); danceMoves.Add(newDanceMove); Debug.Log("Spawned!"); } }
private static (List <string> Sequences, List <DanceMove> DanceMoves) GetDanceMoves() { var sequences = new List <string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p" }; var danceMoves = new List <DanceMove>(); var allInstructions = File.ReadAllText(FilePath).Split(','); foreach (var instruction in allInstructions) { var danceMove = new DanceMove(); var move = instruction.Substring(0, 1); var rest = instruction.Substring(1, instruction.Length - 1).Split('/'); if (move.ToUpper() == "S") { danceMove.Move = Move.Spin; danceMove.SpinAmount = int.Parse(rest[0]); } else if (move.ToUpper() == "X") { danceMove.Move = Move.Exchange; danceMove.ExchangeFirst = int.Parse(rest[0]); danceMove.ExchangeSecond = int.Parse(rest[1]); } else { danceMove.Move = Move.Partner; danceMove.PartnerFirst = rest[0]; danceMove.PartnerSecond = rest[1]; } danceMoves.Add(danceMove); } return(sequences, danceMoves); }
// Use this for initialization public override void OnStart() { timingP1 = timingObjectP1.GetComponent <SpriteRenderer>(); timingP2 = timingObjectP2.GetComponent <SpriteRenderer>(); lastMove = timingPairs[lastPairIndex].firstValue; nextInstruction.sprite = lastMove.moveInstruction; inputCheck = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputCheck>(); scoringSystem = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoringSystem>(); if (timingPairs.Length == 0) { started = false; } instruction.sprite = timingPairs[lastPairIndex].firstValue.moveInstruction; timingP1.sprite = instruction.sprite; timingP1.gameObject.transform.localScale = new Vector3(scaleTiming, scaleTiming, 1); timingP2.gameObject.transform.localScale = timingP1.gameObject.transform.localScale; timingP2.sprite = timingP1.sprite; if (lastPairIndex + 1 <= timingPairs.Length - 1) { nextInstruction.sprite = timingPairs[lastPairIndex + 1].firstValue.moveInstruction; } else { nextInstruction.sprite = voidSprite; } timingP1.gameObject.transform.position = new Vector3(-3, -3.75f, 1); timingP2.gameObject.transform.position = new Vector3(3, -3.75f, 1); timingObjectP1Small.transform.position = timingP1.gameObject.transform.position; timingObjectP2Small.transform.position = timingP2.gameObject.transform.position; if (musicSource != null) { musicSource.Play(); } if (introTime > 0) { started = false; } }
public string Solve() { var danceMoves = danceMovesInput.Split(',').Select(move => DanceMove.Create(move)); var optimizedDanceMoves = TuneMoves(danceMoves); var repeats = new List <string>(); for (int i = 0; i < danceCount; i++) { var c = string.Concat(programs); if (repeats.Contains(c)) { var remainder = 1000000000 % repeats.Count(); return(repeats[remainder]); } repeats.Add(c); foreach (var move in optimizedDanceMoves) { move.Dance(programs); } } return(string.Concat(programs)); }
public void DidMove(DanceMove dm) { switch (dm) { case DanceMove.Clap: ClapCount++; if (ClapCount % 2 == 0) { lc.SetTrigger("Clap"); } else { rc.SetTrigger("Clap"); } cs.SpawnConfettiMiddle(); break; case DanceMove.ArmsLeft: bs.SpawnBalloonsLeft(); break; case DanceMove.ArmsRight: bs.SpawnBalloonsRight(); break; case DanceMove.HandsLeft: cs.SpawnConfettiLeft(); break; case DanceMove.HandsRight: cs.SpawnConfettiRight(); break; default: break; } }
void refreshStatus() { bool dancing = danceStarted || dancefinished; danceCamera.SetActive(dancing); mainCamera.SetActive(!dancing); if (currentFinishedDance) { player.GetComponent <Animator>().SetBool(currentFinishedDance.DanceName, dancefinished); } Player_Behaviour lBehaviour = player.GetComponent <Player_Behaviour>(); lBehaviour.dancing = dancing; lBehaviour.distanceWeapon.SetActive(!dancing); lBehaviour.meleeWeapon.SetActive(!dancing); if (enterDanceModeUI != null) { enterDanceModeUI.SetActive(!dancing); } if (danceUIContainer != null) { danceUIContainer.SetActive(dancing); } if (!dancing) { player.GetComponent <ParticleSystem>().Stop(); } if (!dancefinished) { currentFinishedDance = null; } }
public void ExecuteDance(DanceMove move) { if (!_executed.Contains(move.Id)) { _executed.Add(move.Id); Save(); } }
public void GetInstance_ReturnsCorrectType(string input, Type expected) { Assert.IsInstanceOf(expected, DanceMove.GetInstance(input)); }
public void GetInstance_InvalidInput_ThrowsException() { Assert.Throws <ArgumentException>(() => DanceMove.GetInstance("bad")); }
public int CheckScore(DanceMove currentMove, int timeMultiplier, Players player) { return((int)(100 * GetLimbMultiplier(currentMove) * CheckLimbs(currentMove, player) * timeMultiplier)); }
private bool SequenceMatches(DanceMove danceMove) { if (danceMove.Steps.Length == 0) { return false; } if (danceMove.Steps.Length > _commandHistory.Count) { return false; } if (!danceMove.IsAvailable(_world)) { return false; } return ExactSequenceMatches(danceMove, _commandHistory) || ExactSequenceMatches(danceMove, _commandHistoryFlip); }
public void SetCurrentMove(DanceMove move) { MoveText.text = " ABCD".Substring((int)move, 1); }
protected override void StartNewIItem() { currentItem = new DanceMove(); }
public override bool OnUpdate() { if (started == true && isPaused == false) { timingP1.enabled = true; timingP2.enabled = true; accumulatedTime += Time.deltaTime; if (accumulatedTime <= GetTiming()) { AnimateTiming(GetTiming(), accumulatedTime); CheckTiming(accumulatedTime); } else { if (moveRatedP1 == false) { scoringSystem.AddFirstPlayerScore(inputCheck.CheckScore(lastMove, 1, InputCheck.Players.PlayerOne), inputCheck.GetMaxScore(lastMove), false); } if (moveRatedP2 == false) { scoringSystem.AddSecondPlayerScore(inputCheck.CheckScore(lastMove, 1, InputCheck.Players.PlayerTwo), inputCheck.GetMaxScore(lastMove), false); } lastPairIndex++; if (timingPairs.Length <= lastPairIndex) { started = false; stateFinished = true; instruction.sprite = voidSprite; nextInstruction.sprite = voidSprite; lastPairIndex = 0; accumulatedTime = 0f; return(false); } moveRatedP1 = false; moveRatedP2 = false; accumulatedTime = 0f; instruction.sprite = timingPairs[lastPairIndex].firstValue.moveInstruction; if (lastPairIndex + 1 <= timingPairs.Length - 1) { nextInstruction.sprite = timingPairs[lastPairIndex + 1].firstValue.moveInstruction; } else { nextInstruction.sprite = voidSprite; } timingP1.sprite = voidSprite; timingP2.sprite = voidSprite; //timingObjectP1Small.GetComponent<SpriteRenderer>().sprite = voidSprite; //timingObjectP2Small.GetComponent<SpriteRenderer>().sprite = voidSprite; timingP1.gameObject.transform.localScale = new Vector3(scaleTiming, scaleTiming, 1); timingP1.color = new Color(1f, 1f, 1f, 0.25f); timingP2.gameObject.transform.localScale = timingP1.gameObject.transform.localScale; timingP2.color = timingP1.color; timingP1.sprite = instruction.sprite; timingP2.sprite = timingP1.sprite; timingObjectP1Small.GetComponent <SpriteRenderer>().sprite = timingP1.sprite; timingObjectP2Small.GetComponent <SpriteRenderer>().sprite = timingP2.sprite; lastMove = timingPairs[lastPairIndex].firstValue; } } else if (intro == true) { timingP1.sprite = voidSprite; timingP2.sprite = voidSprite; accumulatedTime += Time.deltaTime; if (accumulatedTime >= introTime) { timingP1.enabled = true; timingP2.enabled = true; timingP1.sprite = instruction.sprite; timingP2.sprite = instruction.sprite; timingObjectP1Small.GetComponent <SpriteRenderer>().sprite = timingP1.sprite; timingObjectP2Small.GetComponent <SpriteRenderer>().sprite = timingP2.sprite; timingP1.gameObject.transform.localScale = new Vector3(scaleTiming, scaleTiming, 1); timingP1.color = new Color(1f, 1f, 1f, 0.25f); timingP2.gameObject.transform.localScale = new Vector3(scaleTiming, scaleTiming, 1); timingP2.color = new Color(1f, 1f, 1f, 0.25f); started = true; intro = false; accumulatedTime = 0f; } } return(true); }
private bool ExactSequenceMatches(DanceMove danceMove, List<DanceStepPair> history) { return !danceMove.Steps.Where((t, i) => !Match(history[history.Count - i - 1], danceMove.Steps[danceMove.Steps.Length - i - 1])).Any(); }
private void ExecuteDanceMove(DanceMove dance) { _icon.ShowDanceIcon(dance.Id); DancesExecuted.Instance.ExecuteDance(dance); dance.Effect(_world); }
public void Create_ParsesCorrectSpinCount() { var move = DanceMove.GetInstance("s1") as SpinMove; Assert.AreEqual(1, move.SpinCount); }
void OnGUI() { if (gameController.gameStarted) { Event m_Event = Event.current; if (m_Event.type == EventType.KeyDown && cooldown == 0) { cooldown = 5; if (!danceStarted) { if (dancefinished) { //stop when the dance move has ended if (!player.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName(currentFinishedDance.DanceName) || player.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).normalizedTime >= 1) { dancefinished = false; } } else { if (m_Event.Equals(Event.KeyboardEvent(KeyCode.F.ToString()))) { danceStarted = true; } } } else { if (currentStep == 0) { for (int i = 0; i < danceMoves.Count; i++) { if (m_Event.Equals(Event.KeyboardEvent(danceMoves[i].keyCombination[0].ToString()))) { //Debug.Log("DanceStarted"); currentMove = i; currentStep = 1; break; } } if (currentStep == 0) { danceStarted = false; } } else { DanceMove lMove = danceMoves[currentMove]; if (m_Event.Equals(Event.KeyboardEvent(lMove.keyCombination[currentStep].ToString()))) { //Debug.Log("Dance continued for real"); currentStep++; if (currentStep == lMove.keyCombination.Count) { //Debug.Log("FInished"); danceStarted = false; dancefinished = true; currentFinishedDance = lMove; currentMove = 0; currentStep = 0; //player.GetComponent<Animator>().SetTrigger(lMove.DanceName); soundManager.startMusic(lMove.DanceName); player.GetComponent <ParticleSystem>().Play(); } } else { danceStarted = false; currentMove = 0; currentStep = 0; } } } refreshStatus(); } else if (m_Event.type == EventType.MouseDown) { danceStarted = false; dancefinished = false; refreshStatus(); } } }
public void QueueMove(DanceMove move) { queue.Enqueue(move); }
public void ShowDanceMove(DanceMove dance) { // TODO }
private void setMove(Animator animator, DanceMove move) { animator.gameObject.GetComponent <DanceGame>().SetCurrentMove(move); animator.SetInteger("DanceMove", (int)move); }