void Start() { seun = new LearningClassTeammates(); seun.playerName = "BlazinkidHD"; seun.classType = "Technoblader"; seun.role = "DPS"; soraya = new LearningClassTeammates(); soraya.playerName = "FenixLady"; soraya.classType = "Sorcerer"; soraya.role = "Buffer"; seun.teammate = soraya; soraya.teammate = seun; if (seun.IsPairedWith(soraya) && soraya.IsPairedWith(seun)) { Debug.Log(seun.playerName + " is paired with " + soraya.playerName); } else if (seun.IsPairedWith(soraya) && !soraya.IsPairedWith(seun)) { Debug.Log(seun.playerName + " is no longer paired with " + soraya.playerName); } else { Debug.Log(seun.playerName + " and " + soraya.playerName + " have yet to find teammates"); } }
public bool IsPairedWith(LearningClassTeammates partner) { //Condition to check that a Teammate is stored in the variable partner if (teammate != null) { //Statement to check that the passed partner variable is thhe same as the stored teammate if (partner == this.teammate) { return(true); } //If the teammate is in a team with another player else { return(false); } } //If the teammate variable has an unassigned value //The player is unmatched with no teammate else { return(false); } }