protected override void Skill(int skill) { switch (skill) { case 1: if (stillInvisible) { break; } isTargetable = false; stillInvisible = true; critMultiplier = 1.6f; invisibility = StartCoroutine(Invisibility()); break; case 2: break; case 3: if (!backstabInitiated) { backstabInitiated = true; backstabThreshold = PatternSynch.CalculateNotesInTime(backstabDuration); if (backstabThreshold > backstabMaxThreshold) { backstabThreshold = backstabMaxThreshold; } lockedEnemy.Stun(); } break; } }
private void InitializeSynchronizers(Player p, int ps) { PatternSynch patSyn = null; GameObject o = null; switch (ps) { case 0: o = (GameObject)Instantiate(Resources.Load("General/Synchronizers/MelodySynch")); break; case 1: o = (GameObject)Instantiate(Resources.Load("General/Synchronizers/ArmonizerSynch")); break; case 2: o = (GameObject)Instantiate(Resources.Load("General/Synchronizers/BassSynch")); break; case 3: o = (GameObject)Instantiate(Resources.Load("General/Synchronizers/PercussionSynch")); break; } o.name = o.name.Replace("(Clone)", ""); patSyn = o.GetComponent <PatternSynch>(); patSyn.LineSync = (PatternSynch.LineSynch)ps; p.PatternSynch = patSyn; }
private void SetNoteValues(List <Note> nl, PatternSynch ps) { bool[] restNotes = new bool[nl.Count]; BeatValue[] beatValues = new BeatValue[nl.Count]; BeatValue[] leggatoValues = new BeatValue[nl.Count]; BeatValue[] secondLeggatoValues = new BeatValue[nl.Count]; for (int i = 0; i < nl.Count; i++) { if (nl[i].GetColor() == NoteColor.NONE) { restNotes[i] = true; } else { restNotes[i] = false; } beatValues[i] = nl[i].GetBeatValue(); leggatoValues[i] = nl[i].GetLegatto(); secondLeggatoValues[i] = nl[i].GetSecondLegatto(); } samplePeriods = new double[beatValues.Length]; // Calculate number of samples between each beat in the sequence. for (int i = 0; i < beatValues.Length; ++i) { if (leggatoValues[i] == BeatValue.None) { samplePeriods[i] = 60f / (bpm * BeatDecimalValues.values[(int)beatValues[i]]); } else if (secondLeggatoValues[i] == BeatValue.None) { samplePeriods[i] = 60f / (bpm * BeatDecimalValues.values[(int)beatValues[i]]) + 60f / (bpm * BeatDecimalValues.values[(int)leggatoValues[i]]); } else { samplePeriods[i] = 60f / (bpm * BeatDecimalValues.values[(int)beatValues[i]]) + 60f / (bpm * BeatDecimalValues.values[(int)leggatoValues[i]]) + 60f / (bpm * BeatDecimalValues.values[(int)secondLeggatoValues[i]]); } } ps.SetSamplePeriods(samplePeriods, restNotes); //ps.gameObject.GetComponent<NotePooler>().SetBullets(nl, ps); }
protected override void Skill(int skill) { switch (skill) { case 1: if (!isSuckingLife && isLockedOnEnemy) { healingNotesQty = PatternSynch.CalculateNotesInTime(healingTime); isSuckingLife = true; } break; case 2: if (!isShielding && currentShiledPoints > 0) { isShielding = true; DeployShields(); StartCoroutine(SelfShieldingTimer()); } break; case 3: if (!isChargingAttack && currentShiledPoints > 0) { if (FindEnemiesToAttack()) { isChargingAttack = true; selfSpecial = true; chargeNotesQty = PatternSynch.CalculateNotesInTime(chargeTime); cameraMovement.UpdatePlayerBar(); } } break; } }
public void SetBullets(List <Note> nl, PatternSynch ps) { //Split each color into its own list int colorCounter = 0; int restCounter = 0; foreach (Note n in nl) { bool toAdd = false; switch (n.GetColor()) { case NoteColor.RIGHT: rightNotes.Add(colorCounter); toAdd = true; break; case NoteColor.LEFT: leftNotes.Add(colorCounter); toAdd = true; break; case NoteColor.DOWN: downNotes.Add(colorCounter); toAdd = true; break; case NoteColor.UP: upNotes.Add(colorCounter); toAdd = true; break; case NoteColor.NONE: restCounter++; toAdd = false; break; } if (toAdd) { inputList.Add(nl[colorCounter + restCounter].GetTypeOfInput()); notesValue.Add(nl[colorCounter + restCounter].GetBeatValue()); colorCounter++; } } //Create the pool of reusable objects Transform parent = GameObject.Find("NotesPathP" + ps.Player.PlayerNumber).transform; ///Sacar después para que funcione con el menú for (int i = 0; i < 16; i++) //Normal notes { for (int j = 0; j < BulletsToPool.Count; j++) { GameObject obj = Instantiate(BulletsToPool[j]); //Instantiate notes Projectile p = obj.GetComponent <Projectile>(); //Get projectile component obj.transform.SetParent(parent.Find("Notes")); //Set as child of note for organization p.Source = Projectile.Projectile_Source.PLAYER; //Every note begins as a player source p.AssignMaterial(0); //Self explanatory obj.SetActive(false); ReAssignValues(ps, p); } } for (int i = 0; i < 5; i++) { for (int j = 0; j < RaysToPool.Count; j++) { GameObject obj = Instantiate(RaysToPool[j]); obj.SetActive(false); OrderRays(obj); } } for (int i = 0; i < 6; i++) { for (int j = 0; j < ParticlesToPool.Count; j++) { GameObject obj = Instantiate(ParticlesToPool[j]); obj.transform.SetParent(GameObject.Find("Particles").transform); obj.SetActive(false); hitParticles.Add(obj); } } initialDict = bulletsInDict; //Save config of initial Dictionary in case of restarting level }
//Reassigns the id of the deactivated bullet so it can be shoot again in the correct time public void ReAssignValues(PatternSynch ps, Projectile _proj) { Projectile p = _proj; if (p.isActiveAndEnabled) { return; } else { switch (_proj.tag) { case "RIGHT": if (rightNotes.Count > 0) { p.Id = rightNotes[currentRight]; p.noteColor = NoteColor.RIGHT; currentRight = (++currentRight == rightNotes.Count ? 0 : currentRight); } else { p.Id = -1; } break; case "LEFT": if (leftNotes.Count > 0) { p.Id = leftNotes[currentLeft]; p.noteColor = NoteColor.LEFT; currentLeft = (++currentLeft == leftNotes.Count ? 0 : currentLeft); } else { p.Id = -1; } break; case "DOWN": if (downNotes.Count > 0) { p.Id = downNotes[currentDown]; p.noteColor = NoteColor.DOWN; currentDown = (++currentDown == downNotes.Count ? 0 : currentDown); } else { p.Id = -1; } break; case "UP": if (upNotes.Count > 0) { p.Id = upNotes[currentUp]; p.noteColor = NoteColor.UP; currentUp = (++currentUp == upNotes.Count ? 0 : currentUp); } else { p.Id = -1; } break; } if (p.Id != -1) { p.InputType = inputList[p.Id]; p.NoteValue = notesValue[p.Id]; p.destroyed = false; if (p.InputType == TypeOfInput.HOLD) { p.HoldTime = (float)ps.samplePeriods[p.Id]; } } } if (p.Id != -1) { bulletsInDict[p.Id] = _proj; } }
protected virtual void Awake() { patternSynch = GetComponent <PatternSynch>(); objectPooler = GetComponent <NotePooler>(); }
protected override void Skill(int skill) { switch (skill) { case 1: HandleYoYo(); break; case 2: switch (currentYoYo) { case YoYo.YELLOW: if (hasYellow && !trapOnCooldown) { trapPosition = transform.position; trapDeployed = true; hasYellow = false; HandleYoYo(); //Drop Trap trapPulse.transform.position = transform.position; trapPulse.SetActive(true); } else { trapDeployed = false; hasYellow = true; trapOnCooldown = true; //Pick up trap } break; case YoYo.RED: if (explosionAim) { DrawBoomArea(); } else { Boom(); } break; case YoYo.VIOLET: if (lockedEnemy != null) { if (!phantomOnCooldown) { PhantomizeBaddies(); } } break; } break; case 3: if (!isSkillThreeOnCooldown && !isJuggling) { isJuggling = true; ultNotesQty = PatternSynch.CalculateNotesInTime(ultTime); ultNotesPerYoYo = Mathf.RoundToInt(ultNotesQty / 3); int remainder = ultNotesQty - (ultNotesPerYoYo * 3); ultNotesFirst = ultNotesSecond = ultNotesLast = ultNotesPerYoYo; if (remainder > 0) { ultNotesLast = ultNotesPerYoYo + remainder; } } break; } }