private void GetDirectionAndDistanceToOtherStudent(Student s1, Student s2, out PassDirection passDirection, out float distance) { var dir = s2.gameObject.transform.position - s1.gameObject.transform.position; distance = dir.magnitude; dir = dir.normalized; float biggestD = -1.0f; passDirection = PassDirection.NONE; foreach (PassDirection pd in System.Enum.GetValues(typeof(PassDirection))) { if (pd >= PassDirection.NONE) { continue; } int i = (int)pd; float d = Vector3.Dot(dir, Student.DirectionVectors[i]); if (d > biggestD) { biggestD = d; passDirection = pd; } } }
public LoverStudent partner; //Must also be another lover student public override Student PassNote(PassDirection passDirection) { //Just passes the note as normal because the only way this student //can receive a note is via the partner. //The student will be 'magically' set active return(base.PassNote(passDirection)); }
public override Student PassNote(PassDirection passDirection) { //This student can pass the note over a student //Find all the students in the direction throw new NotImplementedException(); }
public MovingInformation(int passZoneId, PassDirection direction, int progress) { PassZoneId = passZoneId; Direction = direction; Progress = progress; _passZone = Data.Data.GetPassZone(passZoneId); }
public void RecieveNote(Student a_PassingStudent, PassDirection a_Direction) { PassDirection oppDir = OppositeDirection[(int)a_Direction]; PlayPassAnimation(oppDir); IsHoldingNote = true; indicators.SetHasPlayerFocus(true); }
//Get connected student private Student GetConnectedStudent(PassDirection a_Direction) { foreach (ConnectedStudent cs in this.Students) { if (cs.Direction == a_Direction) { return(cs.Student.GetComponent <Student>()); } } return(null); }
private void PlayPassAnimation(PassDirection a_Direction) { if (lastTrigger != "") { anim.ResetTrigger(lastTrigger); anim.SetTrigger("Idle"); // need to pass through idle lastTrigger = ""; } int idir = (int)a_Direction; string animTrigger = PassAnimations[idir]; anim.SetTrigger(animTrigger); animTimer = idleResetTimer; lastTrigger = animTrigger; }
public virtual Student PassNote(PassDirection passDirection) { //Is there a student available? // var connectedClassmate = con[passDirection]; // if (connectedClassmate != null) // { // //If so then: // //Transfer note // connectedClassmate.ReceiveNote(this); // //Play animation/sounds etc // //Return the student passed to // return connectedClassmate; // } // return null; throw new NotImplementedException(); }
//pass note public void PassNote(PassDirection a_Direction) { if (isHoldingNote != true) { return; } Student s = GetConnectedStudent(a_Direction); if (s != null) { PlayPassAnimation(a_Direction); isHoldingNote = false; s.RecieveNote(this, a_Direction); indicators.SetHasPlayerFocus(false); AudioManager.Instance.PlayActionSFX("PassNote"); } }
//Checks if the a student is in the correct direction public bool CheckStudentInCorrectDirection(Student other, PassDirection passDirection) { switch (passDirection) { //These must match the declaration order of the PassDirection enums! case PassDirection.Up: return(other.transform.position.y > transform.position.y); case PassDirection.Right: return(other.transform.position.x > transform.position.x); case PassDirection.Down: return(other.transform.position.y < transform.position.y); case PassDirection.Left: return(other.transform.position.x < transform.position.x); default: Debug.LogError("Invalid PassDirection!"); return(false); } }
public Passage GetPassage(PassDirection direction) { return(direction == PassDirection.Forward ? ForwardPassage : BackwardPassage); }
public override Student PassNote(PassDirection passDirection) { //This student passes the now all the way to the last student throw new NotImplementedException(); }
public Card[] GetPass(PassDirection passDirection) { return HC.Hand.Take(3).ToArray(); }
private void Update() { lock (_lock) { Console.Clear(); if (_status == null) { _printer.PrintLoadingScreen(); return; } _printer.PrintNotifications(_notifications); // Battle priority is higher than alerts. if (_status.BattleStatus != null) { if (_typers.BattleTypers == null) { var battleTypers = new BattleTypers(this, _status.BattleStatus.SkillIds, _status.BattleStatus.BattleNeighbors.Concat(new[] { _status.BattleStatus.Player }).Select(p => p.PlayerId)); _typers.SetBattle(battleTypers); } _printer.PrintBattleStatus(_status.BattleStatus, _typers.BattleTypers); return; } _printer.PrintPlayerStatus(_status.PlayerStatus); if (_typers.AlertTypers == null && _alerts.Any()) { _currentAlert = _alerts.Dequeue(); var alertTypers = new AlertTypers(this); _typers.OpenAlert(alertTypers); } if (_typers.AlertTypers != null) { _printer.PrintAlert(_currentAlert, _typers.AlertTypers); return; } if (_isPlayerSelecting) { var battleEligibleNeighbors = _status.ZoneStatus.Neighbors .Where(n => !n.IsInBattle && !n.IsDead); if (_typers.PlayerSelectionTypers == null) { var playerSelectionTypers = new PlayerSelectionTypers(this, battleEligibleNeighbors.Select(n => n.PlayerId)); _typers.SetPlayerSelection(playerSelectionTypers); } if (_selectedPlayers != null) // Typer is done. { _connection.Send(new StartBattleCommand { ParticipantsExceptMeIds = _selectedPlayers }); _selectedPlayers = null; _isPlayerSelecting = false; return; } _printer.PrintPlayerSelectionStatus(battleEligibleNeighbors, _typers.PlayerSelectionTypers); return; } if (_status.PlayerStatus.PassZone != null) { if (_typers.PassZoneTypers == null) { var passZoneTypers = new PassZoneTypers(this, _status.PlayerStatus.PassZone); _typers.SetPassZone(passZoneTypers); _previousDirection = _status.PlayerStatus.PassZone.Direction; } if (_previousDirection != _status.PlayerStatus.PassZone.Direction) { // Update for new direction and distance. var passZoneTypers = new PassZoneTypers(this, _status.PlayerStatus.PassZone); // Can't flip direction. Need to recreate because need smaller/bigger text for reverse direction. _typers.SetPassZone(passZoneTypers); _previousDirection = _status.PlayerStatus.PassZone.Direction; } _printer.PrintPassingStatus(_status.PassZoneStatus, _status.PlayerStatus.PassZone, _typers.PassZoneTypers); return; } var zone = Data.Data.GetZone(_status.PlayerStatus.Zone.ZoneId); if (_typers.ZoneTypers == null) { var zoneTypers = new ZoneTypers(this, zone.ZoneExits.Concat(zone.ZoneEntrances)); _typers.SetZone(zoneTypers); } _printer.PrintZoneInfo(_status.ZoneStatus, _status.PlayerStatus, _typers.ZoneTypers); } }