public PlayerPot Get(int userId) { var pot = PlayerPots.FirstOrDefault(x => x.UserId == userId); if (pot == null) { PlayerPots.Add(new PlayerPot(userId, 0)); return(PlayerPots.First(x => x.UserId == userId)); } return(pot); }
new void Awake() { base.Awake(); Instance = this; animator = GetComponent <Animator>(); dash = GetComponent <PlayerDash>(); potsHandler = GetComponent <PlayerPots>(); holeSensor = this.GetComponentInChildren <HoleSensorController>(); potSensor = this.GetComponentInChildren <PotSensor>(); potSensorDistance = potSensor.transform.localPosition.magnitude; }
public bool Has(int userId) { return(PlayerPots.Any(x => x.UserId == userId)); }