private void Update() { EGarbage pre = _garbageBin; if (Input.GetKeyDown(KeyCode.H)) { _garbageBin = EGarbage.Kitchen; } if (Input.GetKeyDown(KeyCode.J)) { _garbageBin = EGarbage.Recyclable; } if (Input.GetKeyDown(KeyCode.K)) { _garbageBin = EGarbage.Harmful; } if (Input.GetKeyDown(KeyCode.L)) { _garbageBin = EGarbage.Residual; } if (_garbageBin != pre) { PlayerFacade.OnGarbageBinChanged?.Invoke(_garbageBin); } }
public static ConfGarbageBin GetByCategory(EGarbage category) { if (CategoryDict == null) { if (Dict == null) { Dict = ConfUtil.LoadConf <ConfGarbageBin>(); } CategoryDict = new Dictionary <int, ConfGarbageBin>(Dict.Count); foreach (var pair in Dict) { CategoryDict.Add((int)pair.Value._category, pair.Value); } } CategoryDict.TryGetValue((int)category, out var conf); return(conf); }
private void OnGarbageBinChanged(EGarbage category) { _garbageBinImg.sprite = ConfGarbageBin.GetByCategory(category)?.Icon; }