private bool CheckDeposit() { if (resourceCarried == TileTypes.NONE) { return(false); } DepotControllerContainer con = new DepotControllerContainer(); if (TileTypes.IsDepot(right.GetTileType())) { right.GetTileCollider().gameObject.SendMessage("GetDepotController", con); targetDepot = con.controller; if (targetDepot.AcceptsResource(resourceCarried)) { StartDeposit(); return(true); } } if (TileTypes.IsDepot(left.GetTileType())) { left.GetTileCollider().gameObject.SendMessage("GetDepotController", con); targetDepot = con.controller; if (targetDepot.AcceptsResource(resourceCarried)) { StartDeposit(); return(true); } } if (TileTypes.IsDepot(forward.GetTileType())) { forward.GetTileCollider().gameObject.SendMessage("GetDepotController", con); targetDepot = con.controller; if (targetDepot.AcceptsResource(resourceCarried)) { StartDeposit(); return(true); } } return(false); }